r102018 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102017‎ | r102018 | r102019 >
Date:17:54, 4 November 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Minor cleanup
Modified paths:
  • /trunk/extensions/VisualEditor/tests/es/es.DocumentModel.test.js (modified) (history)
  • /trunk/extensions/VisualEditor/tests/es/es.DocumentNode.test.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/tests/es/es.DocumentNode.test.js
@@ -1,6 +1,6 @@
22 module( 'es/bases' );
33
4 -function DocumentNodeStub( items, name, size ) {
 4+function DocumentBranchNodeStub( items, name, size ) {
55 // Inheritance
66 es.DocumentBranchNode.call( this, items );
77
@@ -9,35 +9,35 @@
1010 this.size = size;
1111 }
1212
13 -DocumentNodeStub.prototype.getContentLength = function() {
 13+DocumentBranchNodeStub.prototype.getContentLength = function() {
1414 return this.size;
1515 };
1616
17 -DocumentNodeStub.prototype.getElementLength = function() {
 17+DocumentBranchNodeStub.prototype.getElementLength = function() {
1818 // Mimic document data which has an opening and closing around the content
1919 return this.size + 2;
2020 };
2121
22 -es.extendClass( DocumentNodeStub, es.DocumentBranchNode );
 22+es.extendClass( DocumentBranchNodeStub, es.DocumentBranchNode );
2323
2424 test( 'es.DocumentNode', function() {
2525
2626 // Stub test
2727
2828 strictEqual(
29 - ( new DocumentNodeStub( [], 'a', 0 ) ).getElementLength(),
 29+ ( new DocumentBranchNodeStub( [], 'a', 0 ) ).getElementLength(),
3030 2,
31 - 'DocumentNodeStub.getElementLength() returns initialized length plus 2 for elements'
 31+ 'DocumentBranchNodeStub.getElementLength() returns initialized length plus 2 for elements'
3232 );
3333
3434 // Stubs
3535
36 - var a = new DocumentNodeStub( [], 'a', 0 ),
37 - b = new DocumentNodeStub( [], 'b', 1 ),
38 - c = new DocumentNodeStub( [], 'c', 2 ),
39 - d = new DocumentNodeStub( [], 'd', 3 ),
40 - e = new DocumentNodeStub( [], 'e', 4 ),
41 - root1 = new DocumentNodeStub( [a, b, c, d, e], 'root1', 20 ),
 36+ var a = new DocumentBranchNodeStub( [], 'a', 0 ),
 37+ b = new DocumentBranchNodeStub( [], 'b', 1 ),
 38+ c = new DocumentBranchNodeStub( [], 'c', 2 ),
 39+ d = new DocumentBranchNodeStub( [], 'd', 3 ),
 40+ e = new DocumentBranchNodeStub( [], 'e', 4 ),
 41+ root1 = new DocumentBranchNodeStub( [a, b, c, d, e], 'root1', 20 ),
4242 i;
4343
4444 // getRangeFromNode tests
@@ -122,13 +122,14 @@
123123 //^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
124124 //0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0
125125 // 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8
126 - var f = new DocumentNodeStub( [], 'f', 8 ),
127 - g = new DocumentNodeStub( [], 'g', 8 ),
128 - h = new DocumentNodeStub( [], 'h', 8 ),
129 - root2 = new DocumentNodeStub( [f, g, h], 'root2', 30 );
 126+ var f = new DocumentBranchNodeStub( [], 'f', 8 ),
 127+ g = new DocumentBranchNodeStub( [], 'g', 8 ),
 128+ h = new DocumentBranchNodeStub( [], 'h', 8 ),
 129+ root2 = new DocumentBranchNodeStub( [f, g, h], 'root2', 30 );
130130 // FIXME: QUnit thinks f == g because both are empty arrays. Rawr.
131131 // TODO make sure there is a test case for everything that is special-cased in the code
132 - // TODO also nest with a more complicated nested structure, like the one from es.DocumentModel.test.js
 132+ // TODO also nest with a more complicated nested structure, like the one from
 133+ // es.DocumentModel.test.js
133134
134135 // Possible positions are:
135136 // * before beginning
@@ -243,7 +244,7 @@
244245 { 'node': g },
245246 { 'node': h, 'range': new es.Range( 0, 4 ) }
246247 ],
247 - 'desc': 'Range starting in the middle of the first node and ending in the middle of the third'
 248+ 'desc': 'Range from the middle of the first node to the middle of the third'
248249 },
249250 {
250251 'node': root2,
@@ -252,7 +253,7 @@
253254 { 'node': f, 'range': new es.Range( 4, 8 ) },
254255 { 'node': g, 'range': new es.Range( 0, 0 ) }
255256 ],
256 - 'desc': 'Range starting in the middle of a node and ending at the beginning of the second'
 257+ 'desc': 'Range from the middle of a node to the beginning of the second'
257258 },
258259 {
259260 'node': root2,
@@ -261,7 +262,7 @@
262263 { 'node': f, 'range': new es.Range( 4, 8 ) },
263264 { 'node': g, 'range': new es.Range( 0, 1 ) }
264265 ],
265 - 'desc': 'Range starting in the middle of a node and ending after the first character of the second'
 266+ 'desc': 'Range from in the middle of a node to the first character of the second'
266267 },
267268 {
268269 'node': root2,
@@ -270,7 +271,7 @@
271272 { 'node': f, 'range': new es.Range( 7, 8 ) },
272273 { 'node': g, 'range': new es.Range( 0, 5 ) }
273274 ],
274 - 'desc': 'Range starting before the last character of a node and ending in the middle of the next node'
 275+ 'desc': 'Range from before the last character of a node to the middle of the next node'
275276 },
276277 {
277278 'node': root2,
@@ -279,7 +280,7 @@
280281 { 'node': f, 'range': new es.Range( 8, 8 ) },
281282 { 'node': g, 'range': new es.Range( 0, 5 ) }
282283 ],
283 - 'desc': 'Range starting at the end of a node and ending in the middle of the next node'
 284+ 'desc': 'Range from at the end of a node to the middle of the next node'
284285 }
285286 ];
286287
Index: trunk/extensions/VisualEditor/tests/es/es.DocumentModel.test.js
@@ -668,8 +668,7 @@
669669 },
670670 { 'type': 'retain', 'length': 26 }
671671 ],
672 - 'prepareInsertion splits up paragraph when inserting a paragraph closing and opening into' +
673 - 'a paragraph'
 672+ 'prepareInsertion splits paragraph when inserting a paragraph closing and opening inside it'
674673 );
675674
676675 // Test 7

Status & tagging log