1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/remoting/server/web/web.ui.frontend/config/jsTestDriver.conf Sun Jun 30 12:41:36 2013 +0200
1.3 @@ -0,0 +1,8 @@
1.4 +server: http://localhost:42442
1.5 +
1.6 +load:
1.7 + - public_html/index/ui/script.js
1.8 + - public_html/index/lib/jquery-1.7.1.min.js
1.9 + - test/unit/index/ui/*.js
1.10 +
1.11 +exclude:
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/remoting/server/web/web.ui.frontend/test/unit/index/ui/script-test.js Sun Jun 30 12:41:36 2013 +0200
2.3 @@ -0,0 +1,22 @@
2.4 +HighlightingTest = TestCase("HighlightingTest");
2.5 +
2.6 +HighlightingTest.prototype.testHighlighting = function() {
2.7 + var colored = tokenColoring("0123456789", ["a identifier", "b", "c identifier", "d"], [4, 1, 4, 1]);
2.8 + // aaaabccccd
2.9 + assertEquals('<table><tr><td class="unselectable">1</td><td><span id="p0" class="a identifier" jpt30pos="0">0123</span><span id="p4" class="b" jpt30pos="4">4</span><span id="p5" class="c identifier" jpt30pos="5">5678</span><span id="p9" class="d" jpt30pos="9">9</span></td></tr></table>', colored);
2.10 +
2.11 + $(document).find('body').append("<div id='code'></div>");
2.12 + var scratch = $("#code");
2.13 + scratch.empty();
2.14 + scratch.append(colored);
2.15 + addHighlights([[0, 4], [9, 10]]); //exclusive ends, must be synchronized with the server
2.16 + assertEquals('<table><tbody><tr><td class="unselectable">1</td><td><span id="p0" class="a identifier highlight" jpt30pos="0">0123</span><span id="p4" class="b" jpt30pos="4">4</span><span id="p5" class="c identifier" jpt30pos="5">5678</span><span id="p9" class="d highlight" jpt30pos="9">9</span></td></tr></tbody></table>', scratch.html());
2.17 + scratch.empty();
2.18 + scratch.append(colored);
2.19 + addHighlights([[1, 5], [6, 8]]); //exclusive ends, must be synchronized with the server
2.20 + assertEquals('<table><tbody><tr><td class="unselectable">1</td><td><span id="p0" class="a identifier" jpt30pos="0">0</span><span id="p1" class="a identifier highlight" jpt30pos="1">123</span><span id="p4" class="b highlight" jpt30pos="4">4</span><span id="p5" class="c identifier" jpt30pos="5">5</span><span id="p6" class="c identifier highlight" jpt30pos="6">67</span><span id="p8" class="c identifier" jpt30pos="8">8</span><span id="p9" class="d" jpt30pos="9">9</span></td></tr></tbody></table>', scratch.html());
2.21 + scratch.empty();
2.22 + scratch.append(colored);
2.23 + addHighlights([[0, 2], [9, 10]]); //exclusive ends, must be synchronized with the server
2.24 + assertEquals('<table><tbody><tr><td class="unselectable">1</td><td><span id="p0" class="a identifier highlight" jpt30pos="0">01</span><span id="p2" class="a identifier" jpt30pos="2">23</span><span id="p4" class="b" jpt30pos="4">4</span><span id="p5" class="c identifier" jpt30pos="5">5678</span><span id="p9" class="d highlight" jpt30pos="9">9</span></td></tr></tbody></table>', scratch.html());
2.25 +};