Commit 1e79bc5e authored by Ivan Tyagov's avatar Ivan Tyagov

Extend test to allow testing multiple interactions call on

InteractionGadget. Extend example.
parent e66c4fac
......@@ -3,6 +3,9 @@
<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('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>
</div>
......@@ -12,6 +15,7 @@
gadget = RenderJs.GadgetIndex.getGadgetById("A");
gadget.jsCall1 = function (){alert("A.jscall1");};
gadget.jsCall2 = function (){alert("A.jscall2");};
gadget.htmlEvent3 = function (){alert("A.htmlEvent3");};
gadget.myOwnHtmlEvent1 = function (){
$("#hide").toggle();
alert("A.myOwnHtmlEvent1");
......
......@@ -11,6 +11,7 @@
gadget.jsCall2 = function (){alert("B.jscall2");};
gadget.htmlEvent1 = function (){alert("B.htmlEvent1");};
gadget.htmlEvent2 = function (){alert("B.htmlEvent2");};
gadget.htmlEvent3 = function (){alert("B.htmlEvent3");};
});
//]]>
</script>
\ No newline at end of file
......@@ -23,7 +23,9 @@
{&quot;source&quot;: &quot;A.htmlEvent1&quot;, &quot;destination&quot;: &quot;B.htmlEvent1&quot;},
{&quot;source&quot;: &quot;A.htmlEvent1&quot;, &quot;destination&quot;: &quot;A.myOwnHtmlEvent1&quot;},
{&quot;source&quot;: &quot;A.htmlEvent2&quot;, &quot;destination&quot;: &quot;B.htmlEvent2&quot;},
{&quot;source&quot;: &quot;B.jsCall2&quot;, &quot;destination&quot;: &quot;A.jsCall2&quot;}]">
{&quot;source&quot;: &quot;B.jsCall2&quot;, &quot;destination&quot;: &quot;A.jsCall2&quot;},
{&quot;source&quot;: &quot;main-interactor.htmlEvent3&quot;, &quot;destination&quot;: &quot;A.htmlEvent3&quot;},
{&quot;source&quot;: &quot;main-interactor.htmlEvent3&quot;, &quot;destination&quot;: &quot;B.htmlEvent3&quot;}]">
</div>
</body>
......
......@@ -4,7 +4,7 @@
//<![CDATA[
$(document).ready(function() {
gadget = RenderJs.GadgetIndex.getGadgetById("B");
gadget.inc = function (){counter = counter + 1};
gadget.inc = function (){counter = counter + 1; };
gadget.htmlEvent1 = function (){counter = counter + 1;};
});
//]]>
......
......@@ -12,7 +12,9 @@
id="main-interactor"
data-gadget-connection="[
{&quot;source&quot;: &quot;A.inc&quot;, &quot;destination&quot;: &quot;B.inc&quot;},
{&quot;source&quot;: &quot;A.htmlEvent1&quot;, &quot;destination&quot;: &quot;B.htmlEvent1&quot;}]"></div>
{&quot;source&quot;: &quot;A.htmlEvent1&quot;, &quot;destination&quot;: &quot;B.htmlEvent1&quot;},
{&quot;source&quot;: &quot;main-interactor.multiEvent&quot;, &quot;destination&quot;: &quot;A.inc&quot;},
{&quot;source&quot;: &quot;main-interactor.multiEvent&quot;, &quot;destination&quot;: &quot;B.inc&quot;}]"></div>
......
......@@ -139,6 +139,11 @@ function setupRenderJSTest(){
// fire pure HTML event on A and test it calls respective B method
$('#A').trigger('htmlEvent1');
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);
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment