Last change
on this file since 256 was
256,
checked in by hendrikvanantwerpen, 13 years ago
|
Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).
|
File size:
1.1 KB
|
Line | |
---|
1 | dojo.provide("dojox.highlight.tests.highlight"); |
---|
2 | |
---|
3 | dojo.require("dojox.highlight"); |
---|
4 | dojo.require("dojox.highlight.languages._all"); |
---|
5 | |
---|
6 | doh.register("dojox.highlight.tests.highlight", [ |
---|
7 | function test_validjavascript(){ |
---|
8 | //summary: Test a valid javascript block is highlighted correctly |
---|
9 | var unformatted = "console.debug('hello'); /*Hi*/"; |
---|
10 | var expected = "console.debug(<span class=\"string\">'hello'</span>); <span class=\"comment\">/*Hi*/</span>"; |
---|
11 | var result = dojox.highlight.processString(unformatted, "javascript"); |
---|
12 | doh.assertEqual(expected, result.result); |
---|
13 | doh.assertTrue(!result.partialResult); |
---|
14 | doh.assertEqual("javascript", result.langName); |
---|
15 | }, |
---|
16 | function test_invalidjavascript(){ |
---|
17 | //summary: Test an invalid javascript block with partial result |
---|
18 | var unformatted = "console.debug('hello);\n /*Hi*/"; |
---|
19 | // ^_ unmatched quote |
---|
20 | var expected = "console.debug(<span class=\"string\">"; |
---|
21 | var result = dojox.highlight.processString(unformatted, "javascript"); |
---|
22 | doh.assertEqual(unformatted, result.result); |
---|
23 | doh.assertEqual(expected, result.partialResult); |
---|
24 | doh.assertEqual("javascript", result.langName); |
---|
25 | } |
---|
26 | ]); |
---|
Note: See
TracBrowser
for help on using the repository browser.