Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
renderjs
Commits
efe5890c
Commit
efe5890c
authored
Feb 18, 2013
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve example.
Test multiple InteractionGadget can co-exists in same page.
parent
3c081ec2
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
11 deletions
+34
-11
examples/route/gadget-color-picker.css
examples/route/gadget-color-picker.css
+5
-0
examples/route/gadget-color-picker.html
examples/route/gadget-color-picker.html
+11
-9
test/interactions/A.html
test/interactions/A.html
+1
-0
test/interactions/B.html
test/interactions/B.html
+1
-0
test/interactions/index.html
test/interactions/index.html
+5
-0
test/renderjs_test.js
test/renderjs_test.js
+11
-2
No files found.
examples/route/gadget-color-picker.css
0 → 100644
View file @
efe5890c
.list-item
{
text-decoration
:
none
;
display
:
block
;
width
:
2em
;
}
\ No newline at end of file
examples/route/gadget-color-picker.html
View file @
efe5890c
<html>
<head></head>
<head>
<link
type=
"text/css"
href=
"gadget-color-picker.css"
rel=
"stylesheet"
>
</head>
<body>
<h2>
Color picker
</h2>
<div
class=
"body"
>
<a
href=
"#unknown"
>
Wrong global route
</a>
<ul
style=
"list-style: none;"
>
<li><a
href=
"#/color/0/0/0/"
style=
"text-decoration: none; display: block; width: 2em;
background-color:rgb(0,0,0);"
>
</a></li>
<li><a
href=
"#/color/0/0/150/"
style=
"text-decoration: none; display: block; width: 2em;
background-color:rgb(0,0,150);"
>
</a></li>
<li><a
href=
"#/color/0/150/0/"
style=
"text-decoration: none; display: block; width: 2em;
background-color:rgb(0,150,0);"
>
</a></li>
<li><a
href=
"#/color/0/150/150/"
style=
"text-decoration: none; display: block; width: 2em;
background-color:rgb(0,150,150);"
>
</a></li>
<li><a
href=
"#/color/150/0/0/"
style=
"text-decoration: none; display: block; width: 2em;
background-color:rgb(150,0,0);"
>
</a></li>
<li><a
href=
"#/color/150/0/150/"
style=
"text-decoration: none; display: block; width: 2em;
background-color:rgb(150,0,150);"
>
</a></li>
<li><a
href=
"#/color/150/150/0/"
style=
"text-decoration: none; display: block; width: 2em;
background-color:rgb(150,150,0);"
>
</a></li>
<li><a
href=
"#/color/150/150/150/"
style=
"text-decoration: none; display: block; width: 2em;
background-color:rgb(150,150,150);"
>
</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/150/0/"
class=
"list-item"
style=
"
background-color:rgb(0,150,0);"
>
</a></li>
<li><a
href=
"#/color/0/150/150/"
class=
"list-item"
style=
"
background-color:rgb(0,150,150);"
>
</a></li>
<li><a
href=
"#/color/150/0/0/"
class=
"list-item"
style=
"
background-color:rgb(150,0,0);"
>
</a></li>
<li><a
href=
"#/color/150/0/150/"
class=
"list-item"
style=
"
background-color:rgb(150,0,150);"
>
</a></li>
<li><a
href=
"#/color/150/150/0/"
class=
"list-item"
style=
"
background-color:rgb(150,150,0);"
>
</a></li>
<li><a
href=
"#/color/150/150/150/"
class=
"list-item"
style=
"
background-color:rgb(150,150,150);"
>
</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>
<div
class=
"select-color"
style=
"display: block;"
>
Unknown color (/color/)
</div>
...
...
test/interactions/A.html
View file @
efe5890c
...
...
@@ -5,6 +5,7 @@
$
(
document
).
ready
(
function
()
{
gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
A
"
);
gadget
.
inc
=
function
(){
counter
=
counter
+
1
;};
gadget
.
inc2
=
function
(){
counter
=
counter
+
2
;};
});
//]]>
</script>
\ No newline at end of file
test/interactions/B.html
View file @
efe5890c
...
...
@@ -6,6 +6,7 @@
gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
B
"
);
gadget
.
inc
=
function
(){
counter
=
counter
+
1
;
};
gadget
.
htmlEvent1
=
function
(){
counter
=
counter
+
1
;};
gadget
.
inc2
=
function
(){
counter
=
counter
+
2
;
};
});
//]]>
</script>
\ No newline at end of file
test/interactions/index.html
View file @
efe5890c
...
...
@@ -16,6 +16,11 @@
{"source": "main-interactor.multiEvent", "destination": "A.inc"},
{"source": "main-interactor.multiEvent", "destination": "B.inc"}]"
></div>
<div
data-gadget=
""
id=
"supplimentary-interactor"
data-gadget-connection=
"[
{"source": "A.inc2", "destination": "B.inc2"}]"
></div>
...
...
test/renderjs_test.js
View file @
efe5890c
...
...
@@ -159,7 +159,11 @@ function setupRenderJSTest(){
// we need to wait for all gadgets loading ...
RenderJs
.
bindReady
(
function
()
{
RenderJs
.
InteractionGadget
.
bind
(
$
(
"
#main-interactor
"
));
//RenderJs.InteractionGadget.bind($("#main-interactor"));
$
(
"
div[data-gadget-connection]
"
).
each
(
function
(
index
,
element
)
{
RenderJs
.
InteractionGadget
.
bind
(
$
(
element
));
});
start
();
equal
(
0
,
counter
);
// A.inc will call B.inc, both will increase counter by 1
...
...
@@ -173,6 +177,11 @@ function setupRenderJSTest(){
// when A.inc calls B.inc thus result is 6 NOT 5!
$
(
'
#main-interactor
'
).
trigger
(
'
multiEvent
'
);
equal
(
6
,
counter
);
// check multiple interactors can coexist (a.inc2 +2 -> B.inc2 +2)
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
A
"
).
inc2
();
equal
(
10
,
counter
);
// XXX: test dynamically adding an InteractionGadget
});
});
...
...
@@ -286,7 +295,7 @@ function setupRenderJSTest(){
},
1000
);
},
1000
);
// XXX: test dynamically adding a RouteGadget
});
});
...
...
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