Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Revert "evidence"

This reverts commit 316a1c5.
  • Loading branch information...
commit 71701c14b1855ffb6e4cb932c5d6c266d6009fbf 1 parent f72cd0b
Joshua Peek authored April 12, 2010
3  .gitmodules
@@ -7,3 +7,6 @@
7 7
 [submodule "sprockets"]
8 8
 	path = vendor/sprockets
9 9
 	url = git://github.com/sstephenson/sprockets.git
  10
+[submodule "unittest_js"]
  11
+	path = vendor/unittest_js
  12
+	url = git://github.com/tobie/unittest_js.git
33  Rakefile
@@ -2,11 +2,13 @@ require 'rake'
2 2
 require 'rake/testtask'
3 3
 require 'rake/rdoctask'
4 4
 
5  
-WYSIHAT_ROOT     = File.expand_path(File.dirname(__FILE__))
6  
-WYSIHAT_SRC_DIR  = File.join(WYSIHAT_ROOT, 'src')
7  
-WYSIHAT_DIST_DIR = File.join(WYSIHAT_ROOT, 'dist')
8  
-WYSIHAT_DOC_DIR  = File.join(WYSIHAT_ROOT, 'doc')
9  
-WYSIHAT_TEST_DIR = File.join(WYSIHAT_ROOT, 'test')
  5
+WYSIHAT_ROOT          = File.expand_path(File.dirname(__FILE__))
  6
+WYSIHAT_SRC_DIR       = File.join(WYSIHAT_ROOT, 'src')
  7
+WYSIHAT_DIST_DIR      = File.join(WYSIHAT_ROOT, 'dist')
  8
+WYSIHAT_DOC_DIR       = File.join(WYSIHAT_ROOT, 'doc')
  9
+WYSIHAT_TEST_DIR      = File.join(WYSIHAT_ROOT, 'test')
  10
+WYSIHAT_TEST_UNIT_DIR = File.join(WYSIHAT_TEST_DIR, 'unit')
  11
+WYSIHAT_TMP_DIR       = File.join(WYSIHAT_TEST_UNIT_DIR, 'tmp')
10 12
 
11 13
 desc "Update git submodules"
12 14
 task :update_submodules do
@@ -82,3 +84,24 @@ namespace :doc do
82 84
     rm_rf WYSIHAT_DOC_DIR
83 85
   end
84 86
 end
  87
+
  88
+desc "Builds the distribution, runs the JavaScript unit tests and collects their results."
  89
+task :test => ['test:build']
  90
+
  91
+namespace :test do
  92
+  task :build => [:clean, :dist] do
  93
+    require File.join(WYSIHAT_ROOT, "vendor", "unittest_js", "lib", "unittest_js")
  94
+    builder = UnittestJS::Builder::SuiteBuilder.new({
  95
+      :input_dir  => WYSIHAT_TEST_UNIT_DIR,
  96
+      :assets_dir => WYSIHAT_DIST_DIR
  97
+    })
  98
+    selected_tests = (ENV['TESTS'] || '').split(',')
  99
+    builder.collect(*selected_tests)
  100
+    builder.render
  101
+  end
  102
+
  103
+  task :clean do
  104
+    require File.join(WYSIHAT_ROOT, "vendor", "unittest_js", "lib", "unittest_js")
  105
+    UnittestJS::Builder.empty_dir!(WYSIHAT_TMP_DIR)
  106
+  end
  107
+end
6  test/sprockets.yml
... ...
@@ -1,6 +0,0 @@
1  
-:load_path:
2  
-  - src
3  
-  - vendor/*/src
4  
-:source_files:
5  
-  - vendor/prototype/src/prototype.js
6  
-  - src/wysihat.js
50  test/unit/editor_test.js
... ...
@@ -1,34 +1,32 @@
1  
-function setup() {
2  
-  this.textarea = $('content');
3  
-  this.editor = WysiHat.Editor.attach(this.textarea);
4  
-  this.editor.focus();
5  
-}
  1
+new Test.Unit.Runner({
  2
+  setup: function() {
  3
+    this.textarea = $('content');
  4
+    this.editor = WysiHat.Editor.attach(this.textarea);
  5
+    this.editor.focus();
  6
+  },
6 7
 
7  
-function teardown() {
8  
-  this.editor.innerHTML = "";
9  
-  this.textarea.value = "";
10  
-}
  8
+  teardown: function() {
  9
+    this.editor.innerHTML = "";
  10
+    this.textarea.value = "";
  11
+  },
11 12
 
12  
-test("inertHTML", function() {
13  
-  setup.bind(this)();
  13
+  testInsertHTML: function() {
  14
+    var runner = this;
14 15
 
15  
-  this.editor.insertHTML("<p>Hello.</p>");
16  
-  this.assertEqual("<p>Hello.</p>", this.editor.innerHTML.formatHTMLOutput());
  16
+    this.editor.insertHTML("<p>Hello.</p>");
  17
+    runner.assertEqual("<p>Hello.</p>", this.editor.innerHTML.formatHTMLOutput());
  18
+  },
17 19
 
18  
-  teardown.bind(this)();
19  
-});
20  
-
21  
-test("boldSelection", function() {
22  
-  setup.bind(this)();
23  
-
24  
-  // this.editor.insertHTML("<p>Hello.</p>");
25  
-  this.editor.innerHTML = '<p id="hello">Hello.</p>'.formatHTMLInput();
  20
+  testBoldSelection: function() {
  21
+    var runner = this;
26 22
 
27  
-  window.getSelection().selectNode(this.editor.down('#hello'));
28  
-  this.editor.boldSelection();
  23
+    // this.editor.insertHTML("<p>Hello.</p>");
  24
+    this.editor.innerHTML = '<p id="hello">Hello.</p>'.formatHTMLInput();
29 25
 
30  
-  this.assert(this.editor.boldSelected());
31  
-  this.assertEqual('<p id="hello"><strong>Hello.</strong></p>', this.editor.innerHTML.formatHTMLOutput());
  26
+    window.getSelection().selectNode(this.editor.down('#hello'));
  27
+    this.editor.boldSelection();
32 28
 
33  
-  teardown.bind(this)();
  29
+    runner.assert(this.editor.boldSelected());
  30
+    runner.assertEqual('<p id="hello"><strong>Hello.</strong></p>', this.editor.innerHTML.formatHTMLOutput());
  31
+  }
34 32
 });
326  test/unit/formatter_test.js
... ...
@@ -1,174 +1,182 @@
1  
-test("normalize tags", function() {
2  
-  [
3  
-    ['Hello', 'Hello'],
4  
-    ['Hello\nWorld\n', 'Hello\r\nWorld\r\n'],
5  
-    ['<p>Hello</p>\n<p>World</p>', '<p>Hello</p>\n<p>World</p>'],
6  
-    ['<p>Hello</p>\n<p>World</p>', '<P>Hello</P>\n<P>World</P>'],
7  
-    ['<p class="greeting">Hello</p>\n<p>World</p>', '<P class="greeting">Hello</P>\n<P>World</P>'],
8  
-    ['Hello<br />\nWorld', 'Hello<BR>\r\nWorld']
9  
-  ].each(function(assertion) {
10  
-    this.assertEqual(assertion[0], assertion[1].tidyXHTML());
11  
-  }.bind(this));
12  
-});
  1
+new Test.Unit.Runner({
  2
+  testNormalizeTags: function() {
  3
+    var runner = this;
13 4
 
14  
-test("format html", function() {
15  
-  if (Prototype.Browser.WebKit) {
16 5
     [
17  
-      ['<p>Here is some basic text<br />\nwith a line break.</p>\n\n<p>And maybe another paragraph</p>',
18  
-        '<div>Here is some basic text</div><div>with a line break.</div><div><br></div><div>And maybe another paragraph</div>'],
19  
-      ['<p>Hello</p>\n\n<p>World!</p>', '<div>Hello</div><div><br></div><div>World!</div>'],
20  
-      ['<p>Hello</p>\n\n<p>World!</p>', '<div><p>Hello</p></div><div><br></div><div>World!</div>'],
21  
-      ['<p>Hello</p>\n\n<p>World!</p>', '<div>Hello<p></p></div><div><p></p></div><div><p></p></div><div><p>World!</p></div>'],
22  
-      ['<p>Hello<br />\nWorld!<br />\nGoodbye!</p>', 'Hello<div><div><div>World!<br></div><div>Goodbye!</div></div></div>'],
23  
-      ['<p>Hello<br />\nWorld!<br />\nGoodbye!</p>', 'Hello<div><div><div><div>World!</div><div>Goodbye!</div></div></div></div>'],
24  
-      ['<p>Hello</p>\n\n<p>World!<br />\nGoodbye!</p>', 'Hello<div><br><div><div><div>World!<br></div><div>Goodbye!</div></div></div></div>'],
25  
-      ['<p>Hello<br />\nWorld!</p>\n\n<p>Goodbye!</p>', 'Hello<div><div><div><div>World!<br></div><div><br></div><div>Goodbye!</div></div></div></div>'],
  6
+      ['Hello', 'Hello'],
  7
+      ['Hello\nWorld\n', 'Hello\r\nWorld\r\n'],
  8
+      ['<p>Hello</p>\n<p>World</p>', '<p>Hello</p>\n<p>World</p>'],
  9
+      ['<p>Hello</p>\n<p>World</p>', '<P>Hello</P>\n<P>World</P>'],
  10
+      ['<p class="greeting">Hello</p>\n<p>World</p>', '<P class="greeting">Hello</P>\n<P>World</P>'],
  11
+      ['Hello<br />\nWorld', 'Hello<BR>\r\nWorld']
  12
+    ].each(function(assertion) {
  13
+      runner.assertEqual(assertion[0], assertion[1].tidyXHTML());
  14
+    });
  15
+  },
26 16
 
27  
-      ['<p>Some <strong>bold</strong> text</p>',
28  
-        'Some <span class="Apple-style-span" style="font-weight: bold;">bold</span> text'],
29  
-      ['<p>Some <em>italic</em> text</p>',
30  
-        'Some <span class="Apple-style-span" style="font-style: italic;">italic</span> text'],
31  
-      ['<p>Some <u>underlined</u> text</p>',
32  
-        'Some <span class="Apple-style-span" style="text-decoration: underline;">underlined</span> text'],
33  
-      ['<p>Some <strong><em>bold and italic</em></strong> text</p>',
34  
-        'Some <span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-style: italic;">bold and italic</span></span> text'],
35  
-      ['<p>Some <em><strong>italic and bold</strong></em> text</p>',
36  
-         'Some <span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-weight: bold;">italic and bold</span></span> text'],
37  
-      ['<p>Some <strong><u><em>bold, underlined, and italic</em></u></strong> text</p>',
38  
-       'Some <span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="text-decoration: underline;"><span class="Apple-style-span" style="font-style: italic;">bold, underlined, and italic</span></span></span> text'],
39  
-      ['<p>Hello<br />\n </p>', '<div>Hello</div><div> <span class="Apple-style-span" style="font-weight: bold;"></span></div>'],
40  
-      ['<p>Hello<span id="bookmark"> </span></p>', '<div>Hello<span id="bookmark"> </span></div>'],
  17
+  testFormatHtml: function() {
  18
+    var runner = this;
41 19
 
42  
-      ['<p><img src="http://www.google.com/intl/en_ALL/images/logo.gif"></p>', '<img src="http://www.google.com/intl/en_ALL/images/logo.gif">'],
  20
+    if (Prototype.Browser.WebKit) {
  21
+      [
  22
+        ['<p>Here is some basic text<br />\nwith a line break.</p>\n\n<p>And maybe another paragraph</p>',
  23
+          '<div>Here is some basic text</div><div>with a line break.</div><div><br></div><div>And maybe another paragraph</div>'],
  24
+        ['<p>Hello</p>\n\n<p>World!</p>', '<div>Hello</div><div><br></div><div>World!</div>'],
  25
+        ['<p>Hello</p>\n\n<p>World!</p>', '<div><p>Hello</p></div><div><br></div><div>World!</div>'],
  26
+        ['<p>Hello</p>\n\n<p>World!</p>', '<div>Hello<p></p></div><div><p></p></div><div><p></p></div><div><p>World!</p></div>'],
  27
+        ['<p>Hello<br />\nWorld!<br />\nGoodbye!</p>', 'Hello<div><div><div>World!<br></div><div>Goodbye!</div></div></div>'],
  28
+        ['<p>Hello<br />\nWorld!<br />\nGoodbye!</p>', 'Hello<div><div><div><div>World!</div><div>Goodbye!</div></div></div></div>'],
  29
+        ['<p>Hello</p>\n\n<p>World!<br />\nGoodbye!</p>', 'Hello<div><br><div><div><div>World!<br></div><div>Goodbye!</div></div></div></div>'],
  30
+        ['<p>Hello<br />\nWorld!</p>\n\n<p>Goodbye!</p>', 'Hello<div><div><div><div>World!<br></div><div><br></div><div>Goodbye!</div></div></div></div>'],
43 31
 
44  
-      ['<ol><li>one</li><li>two</li></ol>\n\n<p>not</p>', '<ol><li>one</li><li>two</li></ol><div>not</div>'],
45  
-      ['<ul><li>one</li><li>two</li></ul>\n\n<p>not</p>', '<ul><li>one</li><li>two</li></ul><div>not</div>']
46  
-    ].each(function(assertion) {
47  
-      this.assertEqual(assertion[0], assertion[1].formatHTMLOutput());
48  
-    }.bind(this));
49  
-  } else if (Prototype.Browser.Gecko) {
50  
-    [
51  
-      ['<p>Here is some basic text<br />\nwith a line break.</p>\n\n<p>And maybe another paragraph</p>',
52  
-        'Here is some basic text<br>with a line break.<br><br>And maybe another paragraph<br>'],
53  
-      ['<p>Here is some basic text<br />\nwith a line break.</p>\n\n<p>And maybe another paragraph</p>',
54  
-        'Here is some basic text<br>with a line break.<br><p></p><br>And maybe another paragraph<br>'],
55  
-      ['<p>Hello</p>\n\n<p>World!</p>', 'Hello<br><br>World!'],
56  
-      ['<p>Hello<br />\nWorld!<br />\nGoodbye!</p>', 'Hello<br>World!<br>Goodbye!<br>'],
57  
-      ['<p>Hello<br />\nWorld!</p>\n\n<p>Goodbye!</p>', 'Hello<br>World!<br><br>Goodbye!<br>'],
  32
+        ['<p>Some <strong>bold</strong> text</p>',
  33
+          'Some <span class="Apple-style-span" style="font-weight: bold;">bold</span> text'],
  34
+        ['<p>Some <em>italic</em> text</p>',
  35
+          'Some <span class="Apple-style-span" style="font-style: italic;">italic</span> text'],
  36
+        ['<p>Some <u>underlined</u> text</p>',
  37
+          'Some <span class="Apple-style-span" style="text-decoration: underline;">underlined</span> text'],
  38
+        ['<p>Some <strong><em>bold and italic</em></strong> text</p>',
  39
+          'Some <span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-style: italic;">bold and italic</span></span> text'],
  40
+        ['<p>Some <em><strong>italic and bold</strong></em> text</p>',
  41
+           'Some <span class="Apple-style-span" style="font-style: italic;"><span class="Apple-style-span" style="font-weight: bold;">italic and bold</span></span> text'],
  42
+        ['<p>Some <strong><u><em>bold, underlined, and italic</em></u></strong> text</p>',
  43
+         'Some <span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="text-decoration: underline;"><span class="Apple-style-span" style="font-style: italic;">bold, underlined, and italic</span></span></span> text'],
  44
+        ['<p>Hello<br />\n </p>', '<div>Hello</div><div> <span class="Apple-style-span" style="font-weight: bold;"></span></div>'],
  45
+        ['<p>Hello<span id="bookmark"> </span></p>', '<div>Hello<span id="bookmark"> </span></div>'],
58 46
 
59  
-      ['<p>Some <strong>bold</strong> text</p>',
60  
-        'Some <span style="font-weight: bold;">bold</span> text'],
61  
-      ['<p>Some <em>italic</em> text</p>',
62  
-        'Some <span style="font-style: italic;">italic</span> text'],
63  
-      ['<p>Some <u>underlined</u> text</p>',
64  
-        'Some <span style="text-decoration: underline;">underlined</span> text'],
65  
-      ['<p>Some <em><strong>bold and italic</strong></em> text</p>',
66  
-        'Some <span style="font-weight: bold; font-style: italic;">bold and italic</span> text'],
67  
-       ['<p>Some <em><strong>italic and bold</strong></em> text</p>',
68  
-         'Some <span style="font-style: italic; font-weight: bold;">italic and bold</span> text'],
69  
-       ['<p>Some <u><em><strong>bold, underline, and italic</strong></em></u> text</p>',
70  
-          'Some <span style="font-weight: bold; text-decoration: underline; font-style: italic;">bold, underline, and italic</span> text'],
  47
+        ['<p><img src="http://www.google.com/intl/en_ALL/images/logo.gif"></p>', '<img src="http://www.google.com/intl/en_ALL/images/logo.gif">'],
71 48
 
72  
-      ['<p><img src="http://www.google.com/intl/en_ALL/images/logo.gif"></p>', '<img src="http://www.google.com/intl/en_ALL/images/logo.gif">'],
  49
+        ['<ol><li>one</li><li>two</li></ol>\n\n<p>not</p>', '<ol><li>one</li><li>two</li></ol><div>not</div>'],
  50
+        ['<ul><li>one</li><li>two</li></ul>\n\n<p>not</p>', '<ul><li>one</li><li>two</li></ul><div>not</div>']
  51
+      ].each(function(assertion) {
  52
+        runner.assertEqual(assertion[0], assertion[1].formatHTMLOutput());
  53
+      });
  54
+    } else if (Prototype.Browser.Gecko) {
  55
+      [
  56
+        ['<p>Here is some basic text<br />\nwith a line break.</p>\n\n<p>And maybe another paragraph</p>',
  57
+          'Here is some basic text<br>with a line break.<br><br>And maybe another paragraph<br>'],
  58
+        ['<p>Here is some basic text<br />\nwith a line break.</p>\n\n<p>And maybe another paragraph</p>',
  59
+          'Here is some basic text<br>with a line break.<br><p></p><br>And maybe another paragraph<br>'],
  60
+        ['<p>Hello</p>\n\n<p>World!</p>', 'Hello<br><br>World!'],
  61
+        ['<p>Hello<br />\nWorld!<br />\nGoodbye!</p>', 'Hello<br>World!<br>Goodbye!<br>'],
  62
+        ['<p>Hello<br />\nWorld!</p>\n\n<p>Goodbye!</p>', 'Hello<br>World!<br><br>Goodbye!<br>'],
73 63
 
74  
-      ['<ol><li>one</li><li>two</li></ol>\n\n<p>not</p>', '<ol><li>one</li><li>two</li></ol>not<br>'],
75  
-      ['<ul><li>one</li><li>two</li></ul>\n\n<p>not</p>', '<ul><li>one</li><li>two</li></ul>not<br>']
76  
-    ].each(function(assertion) {
77  
-      this.assertEqual(assertion[0], assertion[1].formatHTMLOutput());
78  
-    }.bind(this));
79  
-  } else if (Prototype.Browser.IE) {
80  
-    [
81  
-      ['', '<P></P>'],
82  
-      ['', '<P></P>\n<P></P>'],
83  
-      ['', '<P>\n<P>&nbsp;</P>\n<P></P>'],
84  
-      ['', '<P>&nbsp;</P>\n<P></P>'],
85  
-      ['<p>One<br />\nTwo</p>\n\n<p>Break</p>',
86  
-        '<P>\n<P>One</P><BR>\n<P>Two</P>\n<P></P>\n<P>\n<P>Break</P>\n<P></P>'],
87  
-      ['<p>Here is some basic text<br />\nwith a line break.</p>\n\n<p>And maybe another paragraph</p>',
88  
-        '<P>\n<P>Here is some basic text</P><BR>\n<P>with a line break.</P><BR>\n<P>&nbsp;</P><BR>\n<P>And maybe another paragraph</P>\n<P></P>'],
89  
-      ['<p>Hello</p>\n\n<p>World!</p>',
90  
-        '<P>\n<P>Hello</P><BR>\n<P>&nbsp;</P><BR>\n<P>World!</P>\n<P></P>'],
91  
-      ['<p>Hello<br />\nWorld!<br />\nGoodbye!</p>',
92  
-        '<P>\n<P>Hello</P><BR>\n<P>World!</P><BR>\n<P>Goodbye!</P>\n<P></P>'],
93  
-      ['<p>Hello<br />\nWorld!</p>\n\n<p>Goodbye!</p>',
94  
-        '<P>\n<P>Hello</P><BR>\n<P>World!</P><BR>\n<P>&nbsp;</P><BR>\n<P>Goodbye!</P>\n<P></P>'],
  64
+        ['<p>Some <strong>bold</strong> text</p>',
  65
+          'Some <span style="font-weight: bold;">bold</span> text'],
  66
+        ['<p>Some <em>italic</em> text</p>',
  67
+          'Some <span style="font-style: italic;">italic</span> text'],
  68
+        ['<p>Some <u>underlined</u> text</p>',
  69
+          'Some <span style="text-decoration: underline;">underlined</span> text'],
  70
+        ['<p>Some <em><strong>bold and italic</strong></em> text</p>',
  71
+          'Some <span style="font-weight: bold; font-style: italic;">bold and italic</span> text'],
  72
+         ['<p>Some <em><strong>italic and bold</strong></em> text</p>',
  73
+           'Some <span style="font-style: italic; font-weight: bold;">italic and bold</span> text'],
  74
+         ['<p>Some <u><em><strong>bold, underline, and italic</strong></em></u> text</p>',
  75
+            'Some <span style="font-weight: bold; text-decoration: underline; font-style: italic;">bold, underline, and italic</span> text'],
95 76
 
96  
-      ['<p>Some <strong>bold</strong> text</p>',
97  
-        'Some <STRONG>bold</STRONG> text'],
98  
-      ['<p>Some <em>italic</em> text</p>',
99  
-        'Some <EM>italic</EM> text'],
100  
-      ['<p>Some <u>underlined</u> text</p>',
101  
-        'Some <U>underlined</U> text'],
  77
+        ['<p><img src="http://www.google.com/intl/en_ALL/images/logo.gif"></p>', '<img src="http://www.google.com/intl/en_ALL/images/logo.gif">'],
102 78
 
103  
-      ['<ol>\n<li>one</li>\n<li>two</li></ol>\n<p>not</p>', '<OL>\n<LI>one</LI>\n<LI>two</LI></OL>\n<P>not</P>'],
104  
-      ['<ul>\n<li>one</li>\n<li>two</li></ul>\n<p>not</p>', '<UL>\n<LI>one</LI>\n<LI>two</LI></UL>\n<P>not</P>']
105  
-    ].each(function(assertion) {
106  
-      this.assertEqual(assertion[0], assertion[1].formatHTMLOutput());
107  
-    }.bind(this));
108  
-  } else if (Prototype.Browser.Opera) {
109  
-    [
110  
-      ['<p>One<br />\nTwo</p>\n\n<p>Break</p>',
111  
-        '<P>One</P><P>Two</P><P></P><P>Break</P>'],
112  
-      ['<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>',
113  
-        '<p>Here is some basic text...</p>\n<p>...with a line break.</p>\n<p>&nbsp;</p>\n<p>We want to put a paragraph...</p>\n<p>&nbsp;</p>\n<p>...right there.</p>'],
114  
-      ['<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>',
115  
-        '<P>Here is some basic text...</P>\n<P>...with a line break.</P>\n<P> </P>\n<P>We want to put a paragraph...</P>\n<P> </P>\n<P>...right there.</P>']
116  
-    ].each(function(assertion) {
117  
-      this.assertEqual(assertion[0], assertion[1].formatHTMLOutput());
118  
-    }.bind(this));
119  
-  }
120  
-});
  79
+        ['<ol><li>one</li><li>two</li></ol>\n\n<p>not</p>', '<ol><li>one</li><li>two</li></ol>not<br>'],
  80
+        ['<ul><li>one</li><li>two</li></ul>\n\n<p>not</p>', '<ul><li>one</li><li>two</li></ul>not<br>']
  81
+      ].each(function(assertion) {
  82
+        runner.assertEqual(assertion[0], assertion[1].formatHTMLOutput());
  83
+      });
  84
+    } else if (Prototype.Browser.IE) {
  85
+      [
  86
+        ['', '<P></P>'],
  87
+        ['', '<P></P>\n<P></P>'],
  88
+        ['', '<P>\n<P>&nbsp;</P>\n<P></P>'],
  89
+        ['', '<P>&nbsp;</P>\n<P></P>'],
  90
+        ['<p>One<br />\nTwo</p>\n\n<p>Break</p>',
  91
+          '<P>\n<P>One</P><BR>\n<P>Two</P>\n<P></P>\n<P>\n<P>Break</P>\n<P></P>'],
  92
+        ['<p>Here is some basic text<br />\nwith a line break.</p>\n\n<p>And maybe another paragraph</p>',
  93
+          '<P>\n<P>Here is some basic text</P><BR>\n<P>with a line break.</P><BR>\n<P>&nbsp;</P><BR>\n<P>And maybe another paragraph</P>\n<P></P>'],
  94
+        ['<p>Hello</p>\n\n<p>World!</p>',
  95
+          '<P>\n<P>Hello</P><BR>\n<P>&nbsp;</P><BR>\n<P>World!</P>\n<P></P>'],
  96
+        ['<p>Hello<br />\nWorld!<br />\nGoodbye!</p>',
  97
+          '<P>\n<P>Hello</P><BR>\n<P>World!</P><BR>\n<P>Goodbye!</P>\n<P></P>'],
  98
+        ['<p>Hello<br />\nWorld!</p>\n\n<p>Goodbye!</p>',
  99
+          '<P>\n<P>Hello</P><BR>\n<P>World!</P><BR>\n<P>&nbsp;</P><BR>\n<P>Goodbye!</P>\n<P></P>'],
121 100
 
122  
-test("format for editor", function() {
123  
-  if (Prototype.Browser.WebKit) {
124  
-    [
125  
-      ['<div>Here is some basic text...</div><div>...with a line break.</div><div><br></div><div>We want to put a paragraph...</div><div><br></div><div>...right there.</div>',
126  
-        '<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>'],
  101
+        ['<p>Some <strong>bold</strong> text</p>',
  102
+          'Some <STRONG>bold</STRONG> text'],
  103
+        ['<p>Some <em>italic</em> text</p>',
  104
+          'Some <EM>italic</EM> text'],
  105
+        ['<p>Some <u>underlined</u> text</p>',
  106
+          'Some <U>underlined</U> text'],
127 107
 
128  
-      ['<div>Some <span style="font-weight: bold;" class="Apple-style-span">bold</span> text</div>',
129  
-        '<p>Some <strong>bold</strong> text</p>'],
130  
-      ['<div>Some <span style="font-style: italic;" class="Apple-style-span">italic</span> text</div>',
131  
-        '<p>Some <em>italic</em> text</p>'],
132  
-      ['<div>Some <span style="text-decoration: underline;" class="Apple-style-span">underlined</span> text</div>',
133  
-        '<p>Some <u>underlined</u> text</p>'],
134  
-      ['<div>Some <span style="font-weight: bold;" class="Apple-style-span"><span style="font-style: italic;" class="Apple-style-span">bold and italic</span></span> text</div>',
135  
-        '<p>Some <strong><em>bold and italic</em></strong> text</p>'],
136  
-      ['<div>Some <span style="font-style: italic;" class="Apple-style-span"><span style="font-weight: bold;" class="Apple-style-span">italic and bold</span></span> text</div>',
137  
-        '<p>Some <em><strong>italic and bold</strong></em> text</p>']
138  
-    ].each(function(assertion) {
139  
-      this.assertEqual(assertion[0], assertion[1].formatHTMLInput());
140  
-    }.bind(this));
141  
-  } else if (Prototype.Browser.Gecko) {
142  
-    [
143  
-      ['Here is some basic text...<br>...with a line break.<br><br>We want to put a paragraph...<br><br>...right there.<br>',
144  
-        '<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>'],
  108
+        ['<ol>\n<li>one</li>\n<li>two</li></ol>\n<p>not</p>', '<OL>\n<LI>one</LI>\n<LI>two</LI></OL>\n<P>not</P>'],
  109
+        ['<ul>\n<li>one</li>\n<li>two</li></ul>\n<p>not</p>', '<UL>\n<LI>one</LI>\n<LI>two</LI></UL>\n<P>not</P>']
  110
+      ].each(function(assertion) {
  111
+        runner.assertEqual(assertion[0], assertion[1].formatHTMLOutput());
  112
+      });
  113
+    } else if (Prototype.Browser.Opera) {
  114
+      [
  115
+        ['<p>One<br />\nTwo</p>\n\n<p>Break</p>',
  116
+          '<P>One</P><P>Two</P><P></P><P>Break</P>'],
  117
+        ['<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>',
  118
+          '<p>Here is some basic text...</p>\n<p>...with a line break.</p>\n<p>&nbsp;</p>\n<p>We want to put a paragraph...</p>\n<p>&nbsp;</p>\n<p>...right there.</p>'],
  119
+        ['<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>',
  120
+          '<P>Here is some basic text...</P>\n<P>...with a line break.</P>\n<P> </P>\n<P>We want to put a paragraph...</P>\n<P> </P>\n<P>...right there.</P>']
  121
+      ].each(function(assertion) {
  122
+        runner.assertEqual(assertion[0], assertion[1].formatHTMLOutput());
  123
+      });
  124
+    }
  125
+  },
145 126
 
146  
-      ['Some <span style="font-weight: bold;">bold</span> text<br>',
147  
-        '<p>Some <strong>bold</strong> text</p>'],
148  
-      ['Some <span style="font-style: italic;">italic</span> text<br>',
149  
-        '<p>Some <em>italic</em> text</p>'],
150  
-      ['Some <span style="text-decoration: underline;">underlined</span> text<br>',
151  
-        '<p>Some <u>underlined</u> text</p>'],
152  
-      ['Some <span style="font-weight: bold;"><span style="font-style: italic;">bold and italic</span></span> text<br>',
153  
-        '<p>Some <strong><em>bold and italic</em></strong> text</p>'],
154  
-      ['Some <span style="font-style: italic;"><span style="font-weight: bold;">italic and bold</span></span> text<br>',
155  
-        '<p>Some <em><strong>italic and bold</strong></em> text</p>']
156  
-    ].each(function(assertion) {
157  
-      this.assertEqual(assertion[0], assertion[1].formatHTMLInput());
158  
-    }.bind(this));
159  
-  } else if (Prototype.Browser.IE) {
160  
-    [
161  
-      [ '<p>Here is some basic text...</p>\n<p>...with a line break.</p>\n<p>&nbsp;</p>\n<p>We want to put a paragraph...</p>\n<p>&nbsp;</p>\n<p>...right there.</p>',
162  
-        '<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>']
163  
-    ].each(function(assertion) {
164  
-      this.assertEqual(assertion[0], assertion[1].formatHTMLInput());
165  
-    }.bind(this));
166  
-  } else if (Prototype.Browser.Opera) {
167  
-    [
168  
-      [ '<p>Here is some basic text...</p>\n<p>...with a line break.</p>\n<p>&nbsp;</p>\n<p>We want to put a paragraph...</p>\n<p>&nbsp;</p>\n<p>...right there.</p>',
169  
-        '<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>']
170  
-    ].each(function(assertion) {
171  
-      this.assertEqual(assertion[0], assertion[1].formatHTMLInput());
172  
-    }.bind(this));
  127
+  testFormatForEditor: function() {
  128
+    var runner = this;
  129
+
  130
+    if (Prototype.Browser.WebKit) {
  131
+      [
  132
+        ['<div>Here is some basic text...</div><div>...with a line break.</div><div><br></div><div>We want to put a paragraph...</div><div><br></div><div>...right there.</div>',
  133
+          '<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>'],
  134
+
  135
+        ['<div>Some <span style="font-weight: bold;" class="Apple-style-span">bold</span> text</div>',
  136
+          '<p>Some <strong>bold</strong> text</p>'],
  137
+        ['<div>Some <span style="font-style: italic;" class="Apple-style-span">italic</span> text</div>',
  138
+          '<p>Some <em>italic</em> text</p>'],
  139
+        ['<div>Some <span style="text-decoration: underline;" class="Apple-style-span">underlined</span> text</div>',
  140
+          '<p>Some <u>underlined</u> text</p>'],
  141
+        ['<div>Some <span style="font-weight: bold;" class="Apple-style-span"><span style="font-style: italic;" class="Apple-style-span">bold and italic</span></span> text</div>',
  142
+          '<p>Some <strong><em>bold and italic</em></strong> text</p>'],
  143
+        ['<div>Some <span style="font-style: italic;" class="Apple-style-span"><span style="font-weight: bold;" class="Apple-style-span">italic and bold</span></span> text</div>',
  144
+          '<p>Some <em><strong>italic and bold</strong></em> text</p>']
  145
+      ].each(function(assertion) {
  146
+        runner.assertEqual(assertion[0], assertion[1].formatHTMLInput());
  147
+      });
  148
+    } else if (Prototype.Browser.Gecko) {
  149
+      [
  150
+        ['Here is some basic text...<br>...with a line break.<br><br>We want to put a paragraph...<br><br>...right there.<br>',
  151
+          '<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>'],
  152
+
  153
+        ['Some <span style="font-weight: bold;">bold</span> text<br>',
  154
+          '<p>Some <strong>bold</strong> text</p>'],
  155
+        ['Some <span style="font-style: italic;">italic</span> text<br>',
  156
+          '<p>Some <em>italic</em> text</p>'],
  157
+        ['Some <span style="text-decoration: underline;">underlined</span> text<br>',
  158
+          '<p>Some <u>underlined</u> text</p>'],
  159
+        ['Some <span style="font-weight: bold;"><span style="font-style: italic;">bold and italic</span></span> text<br>',
  160
+          '<p>Some <strong><em>bold and italic</em></strong> text</p>'],
  161
+        ['Some <span style="font-style: italic;"><span style="font-weight: bold;">italic and bold</span></span> text<br>',
  162
+          '<p>Some <em><strong>italic and bold</strong></em> text</p>']
  163
+      ].each(function(assertion) {
  164
+        runner.assertEqual(assertion[0], assertion[1].formatHTMLInput());
  165
+      });
  166
+    } else if (Prototype.Browser.IE) {
  167
+      [
  168
+        [ '<p>Here is some basic text...</p>\n<p>...with a line break.</p>\n<p>&nbsp;</p>\n<p>We want to put a paragraph...</p>\n<p>&nbsp;</p>\n<p>...right there.</p>',
  169
+          '<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>']
  170
+      ].each(function(assertion) {
  171
+        runner.assertEqual(assertion[0], assertion[1].formatHTMLInput());
  172
+      });
  173
+    } else if (Prototype.Browser.Opera) {
  174
+      [
  175
+        [ '<p>Here is some basic text...</p>\n<p>...with a line break.</p>\n<p>&nbsp;</p>\n<p>We want to put a paragraph...</p>\n<p>&nbsp;</p>\n<p>...right there.</p>',
  176
+          '<p>Here is some basic text...<br />\n...with a line break.</p>\n\n<p>We want to put a paragraph...</p>\n\n<p>...right there.</p>']
  177
+      ].each(function(assertion) {
  178
+        runner.assertEqual(assertion[0], assertion[1].formatHTMLInput());
  179
+      });
  180
+    }
173 181
   }
174 182
 });
704  test/unit/range_test.js
... ...
@@ -1,376 +1,378 @@
1  
-function setup() {
2  
-  $('content').update(
3  
-    "<strong id=\"lorem\">Lorem ipsum</strong> dolor sit amet, " +
4  
-    "<em id=\"consectetuer\">consectetuer</em> adipiscing elit."
5  
-  );
6  
-
7  
-  $('wrapper').cleanWhitespace();
8  
-
9  
-  this.range = document.createRange();
10  
-  this.range.selectNode($('content'));
11  
-}
12  
-
13  
-test("SetStart", function() {
14  
-  setup.bind(this)();
15  
-
16  
-  this.range.setStart($('content'), 2);
17  
-  this.range.setEnd($('content'), 2);
18  
-
19  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
20  
-  this.assertEqual(2, this.range.startOffset, "startOffset");
21  
-  this.assertEqual($('content'), this.range.endContainer, "endContainer");
22  
-  this.assertEqual(2, this.range.endOffset, "endOffset");
23  
-  this.assertEqual(true, this.range.collapsed, "collapsed");
24  
-  this.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
25  
-  this.assertEqual("", this.range.toString(), "toString");
26  
-
27  
-  this.range.setStart($('lorem'), 0);
28  
-  this.range.setEnd($('lorem'), 1);
29  
-
30  
-  this.assertEqual($('lorem'), this.range.startContainer, "startContainer");
31  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
32  
-  this.assertEqual($('lorem'), this.range.endContainer, "endContainer");
33  
-  this.assertEqual(1, this.range.endOffset, "endOffset");
34  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
35  
-  this.assertEqual($('lorem'), this.range.commonAncestorContainer, "commonAncestorContainer");
36  
-  this.assertEqual("Lorem ipsum", this.range.toString(), "toString");
37  
-});
38  
-
39  
-test("SetEnd", function() {
40  
-  setup.bind(this)();
41  
-
42  
-  this.range.setStart($('content'), 1);
43  
-  this.range.setEnd($('content'), 2);
44  
-
45  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
46  
-  this.assertEqual(1, this.range.startOffset, "startOffset");
47  
-  this.assertEqual($('content'), this.range.endContainer, "startContainer");
48  
-  this.assertEqual(2, this.range.endOffset, "endOffset");
49  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
50  
-  this.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
51  
-  this.assertEqual(" dolor sit amet, ", this.range.toString(), "toString");
52  
-
53  
-  this.range.setStart($('consectetuer'), 0);
54  
-  this.range.setEnd($('consectetuer'), 1);
55  
-
56  
-  this.assertEqual($('consectetuer'), this.range.startContainer, "startContainer");
57  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
58  
-  this.assertEqual($('consectetuer'), this.range.endContainer, "startContainer");
59  
-  this.assertEqual(1, this.range.endOffset, "endOffset");
60  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
61  
-  this.assertEqual($('consectetuer'), this.range.commonAncestorContainer, "commonAncestorContainer");
62  
-  this.assertEqual("consectetuer", this.range.toString(), "toString");
63  
-});
64  
-
65  
-test("SetStartBefore", function() {
66  
-  setup.bind(this)();
67  
-
68  
-  this.range.setStartBefore($('lorem'));
69  
-  this.range.setEnd($('content'), 2);
70  
-
71  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
72  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
73  
-  this.assertEqual($('content'), this.range.endContainer, "endContainer");
74  
-  this.assertEqual(2, this.range.endOffset, "endOffset");
75  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
76  
-  this.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
77  
-  this.assertEqual("Lorem ipsum dolor sit amet, ", this.range.toString(), "toString");
78  
-
79  
-  this.range.setStartBefore($('content'));
80  
-  this.range.setEnd($('content'), 2);
81  
-
82  
-  this.assertEqual($('wrapper'), this.range.startContainer, "startContainer");
83  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
84  
-  this.assertEqual($('content'), this.range.endContainer, "endContainer");
85  
-  this.assertEqual(2, this.range.endOffset, "endOffset");
86  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
87  
-  this.assertEqual($('wrapper'), this.range.commonAncestorContainer, "commonAncestorContainer");
88  
-  this.assertEqual("Lorem ipsum dolor sit amet, ", this.range.toString(), "toString");
89  
-});
90  
-
91  
-test("SetStartAfter", function() {
92  
-  setup.bind(this)();
93  
-
94  
-  this.range.setStartAfter($('lorem'));
95  
-  this.range.setEnd($('content'), 2);
96  
-
97  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
98  
-  this.assertEqual(1, this.range.startOffset, "startOffset");
99  
-  this.assertEqual($('content'), this.range.endContainer, "startContainer");
100  
-  this.assertEqual(2, this.range.endOffset, "endOffset");
101  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
102  
-  this.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
103  
-  this.assertEqual(" dolor sit amet, ", this.range.toString(), "toString");
104  
-
105  
-  this.range.setStartAfter($('content'));
106  
-  this.range.setEnd($('wrapper'), 1);
107  
-
108  
-  this.assertEqual($('wrapper'), this.range.startContainer, "startContainer");
109  
-  this.assertEqual(1, this.range.startOffset, "startOffset");
110  
-  this.assertEqual($('wrapper'), this.range.endContainer, "startContainer");
111  
-  this.assertEqual(1, this.range.endOffset, "endOffset");
112  
-  this.assertEqual(true, this.range.collapsed, "collapsed");
113  
-  this.assertEqual($('wrapper'), this.range.commonAncestorContainer, "commonAncestorContainer");
114  
-  this.assertEqual("", this.range.toString(), "toString");
115  
-});
116  
-
117  
-test("SetEndBefore", function() {
118  
-  setup.bind(this)();
119  
-
120  
-  this.range.setStart($('content'), 0);
121  
-  this.range.setEndBefore($('lorem'));
122  
-
123  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
124  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
125  
-  this.assertEqual($('content'), this.range.endContainer, "startContainer");
126  
-  this.assertEqual(0, this.range.endOffset, "endOffset");
127  
-  this.assertEqual(true, this.range.collapsed, "collapsed");
128  
-  this.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
129  
-  this.assertEqual("", this.range.toString(), "toString");
130  
-
131  
-  this.range.setStart($('wrapper'), 0);
132  
-  this.range.setEndBefore($('content'));
133  
-
134  
-  this.assertEqual($('wrapper'), this.range.startContainer, "startContainer");
135  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
136  
-  this.assertEqual($('wrapper'), this.range.endContainer, "startContainer");
137  
-  this.assertEqual(0, this.range.endOffset, "endOffset");
138  
-  this.assertEqual(true, this.range.collapsed, "collapsed");
139  
-  this.assertEqual($('wrapper'), this.range.commonAncestorContainer, "commonAncestorContainer");
140  
-  this.assertEqual("", this.range.toString(), "toString");
141  
-});
142  
-
143  
-test("SetEndAfter", function() {
144  
-  setup.bind(this)();
145  
-
146  
-  this.range.setStart($('content'), 0);
147  
-  this.range.setEndAfter($('lorem'));
148  
-
149  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
150  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
151  
-  this.assertEqual($('content'), this.range.endContainer, "startContainer");
152  
-  this.assertEqual(1, this.range.endOffset, "endOffset");
153  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
154  
-  this.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
155  
-  this.assertEqual("Lorem ipsum", this.range.toString(), "toString");
156  
-
157  
-  this.range.setStart($('content'), 0);
158  
-  this.range.setEndAfter($('content'));
159  
-
160  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
161  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
162  
-  this.assertEqual($('wrapper'), this.range.endContainer, "startContainer");
163  
-  this.assertEqual(1, this.range.endOffset, "endOffset");
164  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
165  
-  this.assertEqual($('wrapper'), this.range.commonAncestorContainer, "commonAncestorContainer");
166  
-  this.assertEqual("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", this.range.toString(), "toString");
167  
-});
168  
-
169  
-test("Collapse", function() {
170  
-  setup.bind(this)();
171  
-
172  
-  this.range.setStart($('content'), 1);
173  
-  this.range.setEnd($('content'), 2);
174  
-  this.range.collapse(true);
175  
-
176  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
177  
-  this.assertEqual(1, this.range.startOffset, "startOffset");
178  
-  this.assertEqual($('content'), this.range.endContainer, "startContainer");
179  
-  this.assertEqual(1, this.range.endOffset, "endOffset");
180  
-  this.assertEqual(true, this.range.collapsed, "collapsed");
181  
-  this.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
182  
-  this.assertEqual("", this.range.toString(), "toString");
183  
-
184  
-  this.range.setStart($('content'), 1);
185  
-  this.range.setEnd($('content'), 2);
186  
-  this.range.collapse(false);
187  
-
188  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
189  
-  this.assertEqual(2, this.range.startOffset, "startOffset");
190  
-  this.assertEqual($('content'), this.range.endContainer, "startContainer");
191  
-  this.assertEqual(2, this.range.endOffset, "endOffset");
192  
-  this.assertEqual(true, this.range.collapsed, "collapsed");
193  
-  this.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
194  
-  this.assertEqual("", this.range.toString(), "toString");
195  
-});
196  
-
197  
-test("SelectNode", function() {
198  
-  setup.bind(this)();
199  
-
200  
-  this.range.selectNode($('content'));
201  
-
202  
-  this.assertEqual($('wrapper'), this.range.startContainer, "startContainer");
203  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
204  
-  this.assertEqual($('wrapper'), this.range.endContainer, "startContainer");
205  
-  this.assertEqual(1, this.range.endOffset, "endOffset");
206  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
207  
-  this.assertEqual($('wrapper'), this.range.commonAncestorContainer, "commonAncestorContainer");
208  
-  this.assertEqual("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", this.range.toString(), "toString");
209  
-
210  
-  this.range.selectNode($('lorem'));
211  
-
212  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
213  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
214  
-  this.assertEqual($('content'), this.range.endContainer, "startContainer");
215  
-  this.assertEqual(1, this.range.endOffset, "endOffset");
216  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
217  
-  this.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
218  
-  this.assertEqual("Lorem ipsum", this.range.toString(), "toString");
219  
-});
220  
-
221  
-test("SelectNodeContents", function() {
222  
-  setup.bind(this)();
223  
-
224  
-  this.range.selectNodeContents($('content'));
225  
-
226  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
227  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
228  
-  this.assertEqual($('content'), this.range.endContainer, "startContainer");
229  
-  this.assertEqual(4, this.range.endOffset, "endOffset");
230  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
231  
-  this.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
232  
-  this.assertEqual("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", this.range.toString(), "toString");
233  
-
234  
-  this.range.selectNodeContents($('lorem'));
  1
+new Test.Unit.Runner({
  2
+  setup: function() {
  3
+    $('content').update(
  4
+      "<strong id=\"lorem\">Lorem ipsum</strong> dolor sit amet, " +
  5
+      "<em id=\"consectetuer\">consectetuer</em> adipiscing elit."
  6
+    );
  7
+
  8
+    $('wrapper').cleanWhitespace();
  9
+
  10
+    this.range = document.createRange();
  11
+    this.range.selectNode($('content'));
  12
+  },
  13
+
  14
+  testSetStart: function() {
  15
+    var runner = this;
  16
+
  17
+    this.range.setStart($('content'), 2);
  18
+    this.range.setEnd($('content'), 2);
  19
+
  20
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  21
+    runner.assertEqual(2, this.range.startOffset, "startOffset");
  22
+    runner.assertEqual($('content'), this.range.endContainer, "endContainer");
  23
+    runner.assertEqual(2, this.range.endOffset, "endOffset");
  24
+    runner.assertEqual(true, this.range.collapsed, "collapsed");
  25
+    runner.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
  26
+    runner.assertEqual("", this.range.toString(), "toString");
  27
+
  28
+    this.range.setStart($('lorem'), 0);
  29
+    this.range.setEnd($('lorem'), 1);
  30
+
  31
+    runner.assertEqual($('lorem'), this.range.startContainer, "startContainer");
  32
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  33
+    runner.assertEqual($('lorem'), this.range.endContainer, "endContainer");
  34
+    runner.assertEqual(1, this.range.endOffset, "endOffset");
  35
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  36
+    runner.assertEqual($('lorem'), this.range.commonAncestorContainer, "commonAncestorContainer");
  37
+    runner.assertEqual("Lorem ipsum", this.range.toString(), "toString");
  38
+  },
  39
+
  40
+  testSetEnd: function() {
  41
+    var runner = this;
  42
+
  43
+    this.range.setStart($('content'), 1);
  44
+    this.range.setEnd($('content'), 2);
  45
+
  46
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  47
+    runner.assertEqual(1, this.range.startOffset, "startOffset");
  48
+    runner.assertEqual($('content'), this.range.endContainer, "startContainer");
  49
+    runner.assertEqual(2, this.range.endOffset, "endOffset");
  50
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  51
+    runner.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
  52
+    runner.assertEqual(" dolor sit amet, ", this.range.toString(), "toString");
  53
+
  54
+    this.range.setStart($('consectetuer'), 0);
  55
+    this.range.setEnd($('consectetuer'), 1);
  56
+
  57
+    runner.assertEqual($('consectetuer'), this.range.startContainer, "startContainer");
  58
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  59
+    runner.assertEqual($('consectetuer'), this.range.endContainer, "startContainer");
  60
+    runner.assertEqual(1, this.range.endOffset, "endOffset");
  61
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  62
+    runner.assertEqual($('consectetuer'), this.range.commonAncestorContainer, "commonAncestorContainer");
  63
+    runner.assertEqual("consectetuer", this.range.toString(), "toString");
  64
+  },
  65
+
  66
+  testSetStartBefore: function() {
  67
+    var runner = this;
  68
+
  69
+    this.range.setStartBefore($('lorem'));
  70
+    this.range.setEnd($('content'), 2);
  71
+
  72
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  73
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  74
+    runner.assertEqual($('content'), this.range.endContainer, "endContainer");
  75
+    runner.assertEqual(2, this.range.endOffset, "endOffset");
  76
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  77
+    runner.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
  78
+    runner.assertEqual("Lorem ipsum dolor sit amet, ", this.range.toString(), "toString");
  79
+
  80
+    this.range.setStartBefore($('content'));
  81
+    this.range.setEnd($('content'), 2);
  82
+
  83
+    runner.assertEqual($('wrapper'), this.range.startContainer, "startContainer");
  84
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  85
+    runner.assertEqual($('content'), this.range.endContainer, "endContainer");
  86
+    runner.assertEqual(2, this.range.endOffset, "endOffset");
  87
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  88
+    runner.assertEqual($('wrapper'), this.range.commonAncestorContainer, "commonAncestorContainer");
  89
+    runner.assertEqual("Lorem ipsum dolor sit amet, ", this.range.toString(), "toString");
  90
+  },
  91
+
  92
+  testSetStartAfter: function() {
  93
+    var runner = this;
  94
+
  95
+    this.range.setStartAfter($('lorem'));
  96
+    this.range.setEnd($('content'), 2);
  97
+
  98
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  99
+    runner.assertEqual(1, this.range.startOffset, "startOffset");
  100
+    runner.assertEqual($('content'), this.range.endContainer, "startContainer");
  101
+    runner.assertEqual(2, this.range.endOffset, "endOffset");
  102
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  103
+    runner.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
  104
+    runner.assertEqual(" dolor sit amet, ", this.range.toString(), "toString");
  105
+
  106
+    this.range.setStartAfter($('content'));
  107
+    this.range.setEnd($('wrapper'), 1);
  108
+
  109
+    runner.assertEqual($('wrapper'), this.range.startContainer, "startContainer");
  110
+    runner.assertEqual(1, this.range.startOffset, "startOffset");
  111
+    runner.assertEqual($('wrapper'), this.range.endContainer, "startContainer");
  112
+    runner.assertEqual(1, this.range.endOffset, "endOffset");
  113
+    runner.assertEqual(true, this.range.collapsed, "collapsed");
  114
+    runner.assertEqual($('wrapper'), this.range.commonAncestorContainer, "commonAncestorContainer");
  115
+    runner.assertEqual("", this.range.toString(), "toString");
  116
+  },
  117
+
  118
+  testSetEndBefore: function() {
  119
+    var runner = this;
  120
+
  121
+    this.range.setStart($('content'), 0);
  122
+    this.range.setEndBefore($('lorem'));
  123
+
  124
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  125
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  126
+    runner.assertEqual($('content'), this.range.endContainer, "startContainer");
  127
+    runner.assertEqual(0, this.range.endOffset, "endOffset");
  128
+    runner.assertEqual(true, this.range.collapsed, "collapsed");
  129
+    runner.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
  130
+    runner.assertEqual("", this.range.toString(), "toString");
  131
+
  132
+    this.range.setStart($('wrapper'), 0);
  133
+    this.range.setEndBefore($('content'));
  134
+
  135
+    runner.assertEqual($('wrapper'), this.range.startContainer, "startContainer");
  136
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  137
+    runner.assertEqual($('wrapper'), this.range.endContainer, "startContainer");
  138
+    runner.assertEqual(0, this.range.endOffset, "endOffset");
  139
+    runner.assertEqual(true, this.range.collapsed, "collapsed");
  140
+    runner.assertEqual($('wrapper'), this.range.commonAncestorContainer, "commonAncestorContainer");
  141
+    runner.assertEqual("", this.range.toString(), "toString");
  142
+  },
  143
+
  144
+  testSetEndAfter: function() {
  145
+    var runner = this;
  146
+
  147
+    this.range.setStart($('content'), 0);
  148
+    this.range.setEndAfter($('lorem'));
  149
+
  150
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  151
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  152
+    runner.assertEqual($('content'), this.range.endContainer, "startContainer");
  153
+    runner.assertEqual(1, this.range.endOffset, "endOffset");
  154
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  155
+    runner.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
  156
+    runner.assertEqual("Lorem ipsum", this.range.toString(), "toString");
  157
+
  158
+    this.range.setStart($('content'), 0);
  159
+    this.range.setEndAfter($('content'));
  160
+
  161
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  162
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  163
+    runner.assertEqual($('wrapper'), this.range.endContainer, "startContainer");
  164
+    runner.assertEqual(1, this.range.endOffset, "endOffset");
  165
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  166
+    runner.assertEqual($('wrapper'), this.range.commonAncestorContainer, "commonAncestorContainer");
  167
+    runner.assertEqual("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", this.range.toString(), "toString");
  168
+  },
  169
+
  170
+  testCollapse: function() {
  171
+    var runner = this;
  172
+
  173
+    this.range.setStart($('content'), 1);
  174
+    this.range.setEnd($('content'), 2);
  175
+    this.range.collapse(true);
  176
+
  177
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  178
+    runner.assertEqual(1, this.range.startOffset, "startOffset");
  179
+    runner.assertEqual($('content'), this.range.endContainer, "startContainer");
  180
+    runner.assertEqual(1, this.range.endOffset, "endOffset");
  181
+    runner.assertEqual(true, this.range.collapsed, "collapsed");
  182
+    runner.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
  183
+    runner.assertEqual("", this.range.toString(), "toString");
  184
+
  185
+    this.range.setStart($('content'), 1);
  186
+    this.range.setEnd($('content'), 2);
  187
+    this.range.collapse(false);
  188
+
  189
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  190
+    runner.assertEqual(2, this.range.startOffset, "startOffset");
  191
+    runner.assertEqual($('content'), this.range.endContainer, "startContainer");
  192
+    runner.assertEqual(2, this.range.endOffset, "endOffset");
  193
+    runner.assertEqual(true, this.range.collapsed, "collapsed");
  194
+    runner.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
  195
+    runner.assertEqual("", this.range.toString(), "toString");
  196
+  },
  197
+
  198
+  testSelectNode: function() {
  199
+    var runner = this;
  200
+
  201
+    this.range.selectNode($('content'));
  202
+
  203
+    runner.assertEqual($('wrapper'), this.range.startContainer, "startContainer");
  204
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  205
+    runner.assertEqual($('wrapper'), this.range.endContainer, "startContainer");
  206
+    runner.assertEqual(1, this.range.endOffset, "endOffset");
  207
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  208
+    runner.assertEqual($('wrapper'), this.range.commonAncestorContainer, "commonAncestorContainer");
  209
+    runner.assertEqual("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", this.range.toString(), "toString");
  210
+
  211
+    this.range.selectNode($('lorem'));
  212
+
  213
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  214
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  215
+    runner.assertEqual($('content'), this.range.endContainer, "startContainer");
  216
+    runner.assertEqual(1, this.range.endOffset, "endOffset");
  217
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  218
+    runner.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
  219
+    runner.assertEqual("Lorem ipsum", this.range.toString(), "toString");
  220
+  },
  221
+
  222
+  testSelectNodeContents: function() {
  223
+    var runner = this;
  224
+
  225
+    this.range.selectNodeContents($('content'));
  226
+
  227
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  228
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  229
+    runner.assertEqual($('content'), this.range.endContainer, "startContainer");
  230
+    runner.assertEqual(4, this.range.endOffset, "endOffset");
  231
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  232
+    runner.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
  233
+    runner.assertEqual("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.", this.range.toString(), "toString");
  234
+
  235
+    this.range.selectNodeContents($('lorem'));
  236
+
  237
+    runner.assertEqual($('lorem'), this.range.startContainer, "startContainer");
  238
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  239
+    runner.assertEqual($('lorem'), this.range.endContainer, "startContainer");
  240
+    runner.assertEqual(1, this.range.endOffset, "endOffset");
  241
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  242
+    runner.assertEqual($('lorem'), this.range.commonAncestorContainer, "commonAncestorContainer");
  243
+    runner.assertEqual("Lorem ipsum", this.range.toString(), "toString");
  244
+  },
  245
+
  246
+  testDeleteContents: function() {
  247
+    var runner = this;
  248
+
  249
+    this.range.selectNodeContents($('lorem'));
  250
+    this.range.deleteContents();
  251
+
  252
+    runner.assertEqual("", $('lorem').innerHTML, "innerHTML");
  253
+  },
  254
+
  255
+  testExtractContents: function() {
  256
+    var runner = this;
  257
+
  258
+    this.range.selectNodeContents($('lorem'));
  259
+    var contents = this.range.extractContents();
  260
+
  261
+    runner.assertEqual("", $('lorem').innerHTML, "innerHTML");
  262
+
  263
+    //IE document does not have any useful methods. Everyone else can just
  264
+    // read textContent, IE needs to append the fragment to another element
  265
+    // and read its innerHTML
  266
+    if (contents.textContent) {
  267
+      runner.assertEqual("Lorem ipsum", contents.textContent, "textContent");
  268
+    } else {
  269
+      var e = new Element('div');
  270
+      e.appendChild(contents);
  271
+      runner.assertEqual("Lorem ipsum", e.innerHTML, "textContent");
  272
+    }
  273
+  },
  274
+
  275
+  testCloneContents: function() {
  276
+    var runner = this;
  277
+
  278
+    this.range.selectNodeContents($('lorem'));
  279
+    var contents = this.range.cloneContents();
  280
+
  281
+    runner.assertEqual("Lorem ipsum", $('lorem').innerHTML, "innerHTML");
  282
+
  283
+    // IE document does not have any useful methods. Everyone else can just
  284
+    // read textContent, IE needs to append the fragment to another element
  285
+    // and read its innerHTML
  286
+    if (contents.textContent) {
  287
+      runner.assertEqual("Lorem ipsum", contents.textContent, "textContent");
  288
+    } else {
  289
+      var e = new Element('div');
  290
+      e.appendChild(contents);
  291
+      runner.assertEqual("Lorem ipsum", e.innerHTML, "textContent");
  292
+    }
  293
+  },
235 294
 
236  
-  this.assertEqual($('lorem'), this.range.startContainer, "startContainer");
237  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
238  
-  this.assertEqual($('lorem'), this.range.endContainer, "startContainer");
239  
-  this.assertEqual(1, this.range.endOffset, "endOffset");
240  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
241  
-  this.assertEqual($('lorem'), this.range.commonAncestorContainer, "commonAncestorContainer");
242  
-  this.assertEqual("Lorem ipsum", this.range.toString(), "toString");
243  
-});
244  
-
245  
-test("DeleteContents", function() {
246  
-  setup.bind(this)();
247  
-
248  
-  this.range.selectNodeContents($('lorem'));
249  
-  this.range.deleteContents();
  295
+  testInsertNode: function() {
  296
+    var runner = this;
250 297
 
251  
-  this.assertEqual("", $('lorem').innerHTML, "innerHTML");
252  
-});
  298
+    var node = new Element('span', {id: 'inserted'}).update("inserted!");
253 299
 
254  
-test("ExtractContents", function() {
255  
-  setup.bind(this)();
  300
+    this.range.selectNode($('lorem'));
  301
+    this.range.insertNode(node);
256 302
 
257  
-  this.range.selectNodeContents($('lorem'));
258  
-  var contents = this.range.extractContents();
  303
+    runner.assertEqual("inserted!", $('inserted').innerHTML, "innerHTML");
  304
+
  305
+    runner.assertEqual($('content'), this.range.startContainer, "startContainer");
  306
+    runner.assertEqual(0, this.range.startOffset, "startOffset");
  307
+    runner.assertEqual($('content'), this.range.endContainer, "startContainer");
  308
+    runner.assertEqual(2, this.range.endOffset, "endOffset");
  309
+    runner.assertEqual(false, this.range.collapsed, "collapsed");
  310
+    runner.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
  311
+  },
259 312
 
260  
-  this.assertEqual("", $('lorem').innerHTML, "innerHTML");
  313
+  testSurrondContents: function() {
  314
+    var runner = this;
261 315
 
262  
-  //IE document does not have any useful methods. Everyone else can just
263  
-  // read textContent, IE needs to append the fragment to another element
264  
-  // and read its innerHTML
265  
-  if (contents.textContent) {
266  
-    this.assertEqual("Lorem ipsum", contents.textContent, "textContent");
267  
-  } else {
268  
-    var e = new Element('div');
269  
-    e.appendChild(contents);
270  
-    this.assertEqual("Lorem ipsum", e.innerHTML, "textContent");
271  
-  }
272  
-});
  316
+    var node;
273 317
 
274  
-test("CloneContents", function() {
275  
-  setup.bind(this)();
  318
+    node = new Element('span', {id: 'wrapper'});
276 319
 
277  
-  this.range.selectNodeContents($('lorem'));
278  
-  var contents = this.range.cloneContents();
  320
+    this.range.selectNodeContents($('lorem'));
  321
+    this.range.surroundContents(node);
279 322
 
280  
-  this.assertEqual("Lorem ipsum", $('lorem').innerHTML, "innerHTML");
  323
+    expected = new Element('div');
  324
+    expected.appendChild(new Element('span', {id: 'wrapper'}).update("Lorem ipsum"));
281 325
 
282  
-  // IE document does not have any useful methods. Everyone else can just
283  
-  // read textContent, IE needs to append the fragment to another element
284  
-  // and read its innerHTML
285  
-  if (contents.textContent) {
286  
-    this.assertEqual("Lorem ipsum", contents.textContent, "textContent");
287  
-  } else {
288  
-    var e = new Element('div');
289  
-    e.appendChild(contents);
290  
-    this.assertEqual("Lorem ipsum", e.innerHTML, "textContent");
291  
-  }
292  
-});
  326
+    runner.assertEqual(expected.innerHTML, $('lorem').innerHTML, "innerHTML");
  327
+  },
293 328
 
294  
-test("InsertNode", function() {
295  
-  setup.bind(this)();
  329
+  testEqualRange: function() {
  330
+    var runner = this;
296 331
 
297  
-  var node = new Element('span', {id: 'inserted'}).update("inserted!");
  332
+    if (!this.range.equalRange) {
  333
+      runner.flunk("equalRange is not implemented");
  334
+      return false;
  335
+    }
298 336
 
299  
-  this.range.selectNode($('lorem'));
300  
-  this.range.insertNode(node);
  337
+    var r1 = document.createRange();
  338
+    r1.selectNodeContents($('lorem'));
301 339
 
302  
-  this.assertEqual("inserted!", $('inserted').innerHTML, "innerHTML");
  340
+    var r2 = document.createRange();
  341
+    r2.selectNodeContents($('lorem'));
303 342
 
304  
-  this.assertEqual($('content'), this.range.startContainer, "startContainer");
305  
-  this.assertEqual(0, this.range.startOffset, "startOffset");
306  
-  this.assertEqual($('content'), this.range.endContainer, "startContainer");
307  
-  this.assertEqual(2, this.range.endOffset, "endOffset");
308  
-  this.assertEqual(false, this.range.collapsed, "collapsed");
309  
-  this.assertEqual($('content'), this.range.commonAncestorContainer, "commonAncestorContainer");
310  
-});
  343
+    var r3 = document.createRange();
  344
+    r3.selectNodeContents($('consectetuer'));
311 345
 
312  
-test("SurrondContents", function() {
313  
-  setup.bind(this)();
  346
+    runner.assert(r1.equalRange(r1), "r1.equalRange(r1)");
  347
+    runner.assert(r2.equalRange(r2), "r2.equalRange(r2)");
  348
+    runner.assert(r3.equalRange(r3), "r3.equalRange(r3)");
314 349
 
315  
-  var node;
  350
+    runner.assert(r1.equalRange(r2), "r1.equalRange(r2)");
  351
+    runner.assert(r2.equalRange(r1), "r2.equalRange(r1)");
  352
+    runner.assert(!r1.equalRange(r3), "r1.equalRange(r3)");
  353
+    runner.assert(!r3.equalRange(r1), "r3.equalRange(r1)");
316 354
 
317  
-  node = new Element('span', {id: 'wrapper'});
  355
+    runner.assert(!r1.equalRange(null), "r1.equalRange(null)");
  356
+    runner.assert(!r2.equalRange(null), "r2.equalRange(null)");
  357
+    runner.assert(!r3.equalRange(null), "r3.equalRange(null)");
  358
+  },
318 359
 
319  
-  this.range.selectNodeContents($('lorem'));
320  
-  this.range.surroundContents(node);
  360
+  testGetNode: function() {
  361
+    var runner = this;
321 362
 
322  
-  expected = new Element('div');
323  
-  expected.appendChild(new Element('span', {id: 'wrapper'}).update("Lorem ipsum"));
  363
+    if (!this.range.getNode) {
  364
+      runner.flunk("getNode is not implemented");
  365
+      return false;
  366
+    }
324 367
 
325  
-  this.assertEqual(expected.innerHTML, $('lorem').innerHTML, "innerHTML");
326  
-});
&nbs