Author: jmorliaguet Date: Sun Feb 26 15:11:20 2006 New Revision: 2479 Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Log:
- simpler test syntax - we remove line breaks when testing HTML Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Sun Feb 26 15:11:20 2006 @@ -328,42 +328,40 @@ function htmlOf(node) { var text = $(node).innerHTML; - return text.toLowerCase(); + return text.toLowerCase().replace(/\r/g, '').replace(/\n/g,''); } try { ctal.process_ctal(document, data); - } catch (e) { - } + } catch (e) {} - new Test.Unit.Runner({ + var inspect = Test.Unit.inspect; - setup: function() { - }, + new Test.Unit.Runner({ testDataStructure: function() { with(this) { assertEqual(1, data['a']); assertEqual(2, data['b']); assertEqual(3, data['c']['d']); assertEqual(4, data['c']['e']); - assertEqual($A([4, 5, 6]).inspect(), $A(data['f']).inspect()); - assertEqual($H({h: 7, i: 8, j: 9}).inspect(), $H(data['g'][0]).inspect()); + assertEqual(inspect([4, 5, 6]), inspect(data['f'])); + assertEqual(inspect({h: 7, i: 8, j: 9}), inspect(data['g'][0])); assertEqual(10, data['k']['l']['m']); assertEqual(1, data['ctrue']); assertEqual(0, data['cfalse']); }}, testPrivateAPI: function() { with(this) { - assertEqual($A(['style', '']).inspect(), - $A(ctal.get_nameexpr('style')).inspect()); - assertEqual($A(['style', 'string:1']).inspect(), - $A(ctal.get_nameexpr('style string:1')).inspect()); - assertEqual($A(['style', 'string:1']).inspect(), - $A(ctal.get_nameexpr(' style string:1 ')).inspect()); - assertEqual($A(['style', 'a/b/c']).inspect(), - $A(ctal.get_nameexpr(' style a/b/c')).inspect()); - assertEqual($A(['style', 'a/b/c; color a/b']).inspect(), - $A(ctal.get_nameexpr('style a/b/c; color a/b')).inspect()); + assertEqual(inspect(['style', '']), + inspect(ctal.get_nameexpr('style'))); + assertEqual(inspect(['style', 'string:1']), + inspect(ctal.get_nameexpr('style string:1'))); + assertEqual(inspect(['style', 'string:1']), + inspect(ctal.get_nameexpr(' style string:1 '))); + assertEqual(inspect(['style', 'a/b/c']), + inspect(ctal.get_nameexpr(' style a/b/c'))); + assertEqual(inspect(['style', 'a/b/c; color a/b']), + inspect(ctal.get_nameexpr('style a/b/c; color a/b'))); }}, testTALContent: function() { with(this) { @@ -422,8 +420,11 @@ }}, testTALAttributesTALContent: function() { with(this) { - assertEqual('<a alt="q" href="http://r/">s</a>', htmlOf("e15")); - assertEqual('<a alt="q" href="http://r/">s</a>', htmlOf("e15b")); + assert(htmlOf("e15") == '<a alt="q" href="http://r/">s</a>' || + htmlOf("e15") == '<a href="http://r/" alt="q">s</a>'); + + assert(htmlOf("e15b") == '<a alt="q" href="http://r/">s</a>' || + htmlOf("e15b") == '<a href="http://r/" alt="q">s</a>'); }}, testTALReplace: function() { with(this) { -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins