Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
renderjs
Commits
abf5797e
Commit
abf5797e
authored
Feb 20, 2013
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up example.
Add multiple instances test for getSelfGadget.
parent
6b9e07ad
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
5 deletions
+33
-5
examples/route/gadget-color-picker.html
examples/route/gadget-color-picker.html
+0
-5
examples/route/index.html
examples/route/index.html
+2
-0
test/renderjs_test.js
test/renderjs_test.js
+23
-0
test/self_gadget/self.html
test/self_gadget/self.html
+8
-0
No files found.
examples/route/gadget-color-picker.html
View file @
abf5797e
...
@@ -5,8 +5,6 @@
...
@@ -5,8 +5,6 @@
<body>
<body>
<h2>
Color picker
</h2>
<h2>
Color picker
</h2>
<div
class=
"body"
>
<div
class=
"body"
>
<a
href=
"#unknown"
>
Wrong global route
</a>
<ul
style=
"list-style: none;"
>
<ul
style=
"list-style: none;"
>
<li><a
href=
"#/color/0/0/0/"
class=
"list-item"
style=
"background-color:rgb(0,0,0);"
>
</a></li>
<li><a
href=
"#/color/0/0/0/"
class=
"list-item"
style=
"background-color:rgb(0,0,0);"
>
</a></li>
<li><a
href=
"#/color/0/0/150/"
class=
"list-item"
style=
"background-color:rgb(0,0,150);"
>
</a></li>
<li><a
href=
"#/color/0/0/150/"
class=
"list-item"
style=
"background-color:rgb(0,0,150);"
>
</a></li>
...
@@ -19,9 +17,6 @@
...
@@ -19,9 +17,6 @@
<li
style=
"text-align: center;"
><a
href=
"#/color/X/X/X"
style=
"text-decoration: none; display: block; width: 2em;"
>
XXX
</a></li>
<li
style=
"text-align: center;"
><a
href=
"#/color/X/X/X"
style=
"text-decoration: none; display: block; width: 2em;"
>
XXX
</a></li>
</ul>
</ul>
<div
class=
"select-color"
style=
"display: block;"
></div>
<div
class=
"select-color"
style=
"display: block;"
></div>
<div
class=
"container"
></div>
</div>
</div>
<script
type=
"text/javascript"
language=
"javascript"
>
<script
type=
"text/javascript"
language=
"javascript"
>
...
...
examples/route/index.html
View file @
abf5797e
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
{"source": "/gadget-two/", "destination": "main-router.gadget_two"}]"
>
{"source": "/gadget-two/", "destination": "main-router.gadget_two"}]"
>
</div>
</div>
<a
href=
"#unknown"
>
Wrong route
</a>
<div
id=
"gadget-color-picker"
<div
id=
"gadget-color-picker"
data-gadget=
"gadget-color-picker.html"
></div>
data-gadget=
"gadget-color-picker.html"
></div>
...
...
test/renderjs_test.js
View file @
abf5797e
...
@@ -307,5 +307,28 @@ function setupRenderJSTest(){
...
@@ -307,5 +307,28 @@ function setupRenderJSTest(){
});
});
module
(
"
GadgetMultipleInstances
"
);
test
(
'
GadgetMultipleInstances
'
,
function
()
{
cleanUp
();
$
(
"
#qunit-fixture
"
).
append
(
'
<div data-gadget="self_gadget/self.html" id="self1"</div>
'
);
$
(
"
#qunit-fixture
"
).
append
(
'
<div data-gadget="self_gadget/self.html" id="self2"</div>
'
);
$
(
"
#qunit-fixture
"
).
append
(
'
<div data-gadget="self_gadget/self.html" id="self3"</div>
'
);
RenderJs
.
bootstrap
(
$
(
"
#qunit-fixture
"
));
stop
();
// we need to wait for all gadgets loading ...
RenderJs
.
bindReady
(
function
()
{
start
();
// check it's instanciated properly and getSelfGadget returns proper gadget instance
equal
(
"
self1
"
,
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
self1
"
).
instance_id
);
equal
(
"
self2
"
,
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
self2
"
).
instance_id
);
equal
(
"
self3
"
,
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
self3
"
).
instance_id
);
// getSelfGadget works only when gadget is loaded so it must be reset in all other cases
equal
(
undefined
,
RenderJs
.
getSelfGadget
());
// only 3 instance should exist
equal
(
3
,
RenderJs
.
GadgetIndex
.
getGadgetList
().
length
);
});
});
};
};
test/self_gadget/self.html
0 → 100644
View file @
abf5797e
<script
type=
"text/javascript"
language=
"javascript"
>
//
<!
[
CDATA
[
$
(
document
).
ready
(
function
()
{
gadget
=
RenderJs
.
getSelfGadget
();
gadget
.
instance_id
=
gadget
.
getId
();
});
//]]>
</script>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment