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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
renderjs
Commits
1e79bc5e
Commit
1e79bc5e
authored
Nov 30, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend test to allow testing multiple interactions call on
InteractionGadget. Extend example.
parent
e66c4fac
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
3 deletions
+17
-3
examples/interactions/A.html
examples/interactions/A.html
+4
-0
examples/interactions/B.html
examples/interactions/B.html
+1
-0
examples/interactions/index.html
examples/interactions/index.html
+3
-1
test/interactions/B.html
test/interactions/B.html
+1
-1
test/interactions/index.html
test/interactions/index.html
+3
-1
test/renderjs_test.js
test/renderjs_test.js
+5
-0
No files found.
examples/interactions/A.html
View file @
1e79bc5e
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
<button
onclick=
"RenderJs.GadgetIndex.getGadgetById('A').jsCall1()"
>
A.jsCall1 -> B.jsCall1
</button>
<button
onclick=
"RenderJs.GadgetIndex.getGadgetById('A').jsCall1()"
>
A.jsCall1 -> B.jsCall1
</button>
<button
onclick=
"$('#A').trigger('htmlEvent1')"
>
HTML event 1
</button>
<button
onclick=
"$('#A').trigger('htmlEvent1')"
>
HTML event 1
</button>
<button
onclick=
"$('#A').trigger('htmlEvent2')"
>
HTML event 2
</button>
<button
onclick=
"$('#A').trigger('htmlEvent2')"
>
HTML event 2
</button>
<button
onclick=
"$('#main-interactor').trigger('htmlEvent3')"
>
A.htmlEvent3 -> InteractionGadget.htmlEvent3 -> A.htmlEvent3 AND B.htmlEvent3
</button>
<p
id=
"hide"
style=
"display:none;"
>
hidden text on myownHTMlEvent1
</p>
<p
id=
"hide"
style=
"display:none;"
>
hidden text on myownHTMlEvent1
</p>
</div>
</div>
...
@@ -12,6 +15,7 @@
...
@@ -12,6 +15,7 @@
gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
A
"
);
gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
A
"
);
gadget
.
jsCall1
=
function
(){
alert
(
"
A.jscall1
"
);};
gadget
.
jsCall1
=
function
(){
alert
(
"
A.jscall1
"
);};
gadget
.
jsCall2
=
function
(){
alert
(
"
A.jscall2
"
);};
gadget
.
jsCall2
=
function
(){
alert
(
"
A.jscall2
"
);};
gadget
.
htmlEvent3
=
function
(){
alert
(
"
A.htmlEvent3
"
);};
gadget
.
myOwnHtmlEvent1
=
function
(){
gadget
.
myOwnHtmlEvent1
=
function
(){
$
(
"
#hide
"
).
toggle
();
$
(
"
#hide
"
).
toggle
();
alert
(
"
A.myOwnHtmlEvent1
"
);
alert
(
"
A.myOwnHtmlEvent1
"
);
...
...
examples/interactions/B.html
View file @
1e79bc5e
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
gadget
.
jsCall2
=
function
(){
alert
(
"
B.jscall2
"
);};
gadget
.
jsCall2
=
function
(){
alert
(
"
B.jscall2
"
);};
gadget
.
htmlEvent1
=
function
(){
alert
(
"
B.htmlEvent1
"
);};
gadget
.
htmlEvent1
=
function
(){
alert
(
"
B.htmlEvent1
"
);};
gadget
.
htmlEvent2
=
function
(){
alert
(
"
B.htmlEvent2
"
);};
gadget
.
htmlEvent2
=
function
(){
alert
(
"
B.htmlEvent2
"
);};
gadget
.
htmlEvent3
=
function
(){
alert
(
"
B.htmlEvent3
"
);};
});
});
//]]>
//]]>
</script>
</script>
\ No newline at end of file
examples/interactions/index.html
View file @
1e79bc5e
...
@@ -23,7 +23,9 @@
...
@@ -23,7 +23,9 @@
{"source": "A.htmlEvent1", "destination": "B.htmlEvent1"},
{"source": "A.htmlEvent1", "destination": "B.htmlEvent1"},
{"source": "A.htmlEvent1", "destination": "A.myOwnHtmlEvent1"},
{"source": "A.htmlEvent1", "destination": "A.myOwnHtmlEvent1"},
{"source": "A.htmlEvent2", "destination": "B.htmlEvent2"},
{"source": "A.htmlEvent2", "destination": "B.htmlEvent2"},
{"source": "B.jsCall2", "destination": "A.jsCall2"}]"
>
{"source": "B.jsCall2", "destination": "A.jsCall2"},
{"source": "main-interactor.htmlEvent3", "destination": "A.htmlEvent3"},
{"source": "main-interactor.htmlEvent3", "destination": "B.htmlEvent3"}]"
>
</div>
</div>
</body>
</body>
...
...
test/interactions/B.html
View file @
1e79bc5e
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
//
<!
[
CDATA
[
//
<!
[
CDATA
[
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
B
"
);
gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
"
B
"
);
gadget
.
inc
=
function
(){
counter
=
counter
+
1
};
gadget
.
inc
=
function
(){
counter
=
counter
+
1
;
};
gadget
.
htmlEvent1
=
function
(){
counter
=
counter
+
1
;};
gadget
.
htmlEvent1
=
function
(){
counter
=
counter
+
1
;};
});
});
//]]>
//]]>
...
...
test/interactions/index.html
View file @
1e79bc5e
...
@@ -12,7 +12,9 @@
...
@@ -12,7 +12,9 @@
id=
"main-interactor"
id=
"main-interactor"
data-gadget-connection=
"[
data-gadget-connection=
"[
{"source": "A.inc", "destination": "B.inc"},
{"source": "A.inc", "destination": "B.inc"},
{"source": "A.htmlEvent1", "destination": "B.htmlEvent1"}]"
></div>
{"source": "A.htmlEvent1", "destination": "B.htmlEvent1"},
{"source": "main-interactor.multiEvent", "destination": "A.inc"},
{"source": "main-interactor.multiEvent", "destination": "B.inc"}]"
></div>
...
...
test/renderjs_test.js
View file @
1e79bc5e
...
@@ -139,6 +139,11 @@ function setupRenderJSTest(){
...
@@ -139,6 +139,11 @@ function setupRenderJSTest(){
// fire pure HTML event on A and test it calls respective B method
// fire pure HTML event on A and test it calls respective B method
$
(
'
#A
'
).
trigger
(
'
htmlEvent1
'
);
$
(
'
#A
'
).
trigger
(
'
htmlEvent1
'
);
equal
(
3
,
counter
);
equal
(
3
,
counter
);
// fire pure HTML event that calls multiple destinations methods
// On its side these methods themself can call each other like now
// when A.inc calls B.inc thus result is 6 NOT 5!
$
(
'
#main-interactor
'
).
trigger
(
'
multiEvent
'
);
equal
(
6
,
counter
);
});
});
});
});
...
...
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