Trevor Parscal
0a32898f3a
Added annotation and attribute tests for transaction constructors
...
Change-Id: I61e5f37b1f866afc4a3b9a18cd6e7e7a08e0958f
2012-05-21 12:21:07 -07:00
Rob Moen
272f502693
Modify getAnnotationsFromOffset to account for annotated leaf nodes.
...
Refactor remaining annotation methods
Refactor tests to use correct annotation types
Change-Id: Ia3ce42b3d11296b4d63277e0e2a1997d23236613
2012-05-21 12:02:04 -07:00
Trevor Parscal
43d62ee8a7
Refactored getMatchingAnnotations and it's tests, and added offsetContainsMatchingAnnotations
...
Change-Id: I9098ef8d9c7f3a4f5db112cfdcb9edb7ffd17b80
2012-05-17 14:37:29 -07:00
Rob Moen
a937ad22f7
Fix getAnnotatedRange to return propper contained range.
...
Fixed tests
Change-Id: I305eb81644fb3c804455b4fc13bdabcce97ea471
2012-05-17 13:17:18 -07:00
Trevor Parscal
3eb31dae09
Whitespace fixes and removed some console.log statements
...
Change-Id: Ifcf8a496fb4b649cbf3ce07290b8f6dda60f179d
2012-05-17 11:29:50 -07:00
Trevor Parscal
08765feab3
Merged ve.dm.DocumentFragment and ve.dm.Document
...
* Also fixed lots of whitespace issues and some global variable introductions
Change-Id: Ia6c82ef0c3b5c4938cf72afa86da6d79e4cb385a
2012-05-17 11:23:56 -07:00
Rob Moen
c2a89626d5
Rewrite getMatchingAnnotations to return a hashmap of matching anntations
...
in the new DM. Change method name getAnnotationRange from offset to
getAnnotatedRangeFromOffset. Write tests
Change-Id: I7028803065409e271ceced73e4803954d4a956dc
2012-05-17 10:46:27 -07:00
Catrope
bcd7431818
Remove getScope(), no longer used
...
Change-Id: I79e067a8e6b3eb151d3ebe1dfc3aaebe242aed39
2012-05-16 20:16:47 -07:00
Rob Moen
fbaea888b9
Rewrite data model methods needed for ui tools
...
getAnnotationRangeFromOffset and offsetContainsAnnotation
which deprecated getAnnotationBoundaries, and getIndexOfAnnotation
write unit tests for proof
Change-Id: I6c0d4e3ca96dd569b1909cd22fce68c3a6fe382c
2012-05-16 15:55:01 -07:00
Christian Williams
eefbee2262
Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite
2012-05-16 13:41:56 -07:00
Christian Williams
189e3eddbe
Another test for HTMLConverter
...
Change-Id: I9b0fa2de44381b363fb6e612884f9911996e941b
2012-05-16 13:41:26 -07:00
Trevor Parscal
0c69370117
Added merge test for ve.dm.TransactionProcessor
...
Also added 2 paragraphs at the end of the example document and updated related tests accordingly
Change-Id: Idd294cbe3975d0a04069e55682a91417160e538a
2012-05-16 13:33:42 -07:00
Trevor Parscal
6d0a24bec6
Greatly simplified selection and node tree comparison tests
...
By first summarizing a node tree or node selection and then using the normal deepEqual function we are able to take advantage of native QUnit functionality to make diagnosing a problem easier under failing conditions and reduce the verbosity of the output under passing conditions.
Change-Id: I4af5d69596cf5459aa32f61ee6d5b8355233c3df
2012-05-15 00:25:27 -07:00
Catrope
cdda5e7920
Improve verbosity of selectNodes test descriptions
...
* Make nodeSelectionEqual() accept a desc parameter and use it for
building descriptions
* Put the array element number in the desciption too
* Add descriptions for selectNodes tests and pass them through
Change-Id: Icd2894d11516234598cbd984cc8d88f705bfc1d6
2012-05-14 22:54:53 -07:00
Catrope
0f0c3c9939
Improvements to nodeTreeEqual():
...
* Don't crash if b.children has a different length than expected
* Don't crash if b.children is absent but expected
* Check if b.children is present when it's not expected
* Add assertion when neither a.children not b.children are present; this
makes the number of assertions for leaves equal to the number of
assertions for branches
* Check attributes too
* Accept a desc parameter, and add node paths (like
list/listItem/paragraph/text) to the descriptions
* Use desc parameter for all calls (some tests were already using it,
even though it didn't actually exist)
Change-Id: Ic56d27d20377e7f4fdfa038fdf4ebe00dcb3e062
2012-05-14 22:43:36 -07:00
Trevor Parscal
3b1d8098e9
Added a replace test that splits elements
...
Change-Id: Ifb9c42c36611b2b936a48b911e9786e2105da09c
2012-05-14 21:50:33 -07:00
Rob Moen
30a671fcea
Rename some tests
...
Change-Id: Ie0c50023a17fead64eb28e6184f70a32b626eaff
2012-05-14 17:24:11 -07:00
Rob Moen
6e8bdde910
Add tests for getAnnotationsFromRange
...
Change-Id: I51aebb54d3d65c3160ac48e9ee971183fb3885bb
2012-05-14 17:22:16 -07:00
Trevor Parscal
14a4c7b780
Fixed annotation processing to support leaf nodes and detect more errors
...
Also added lots of tests
Change-Id: I45fe4fb569d9050d7d79f71f777d82f5b34fdd11
2012-05-14 17:16:30 -07:00
Trevor Parscal
94613589e0
Removed more trailing whitespace in multi-line comment blocks
...
Continues cleanup work done in e0de881a8a
Change-Id: I7165a8f8c4b468793d936fe695de92335c106271
2012-05-14 17:16:30 -07:00
Rob Moen
ca48a4a8a1
Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite
2012-05-14 16:44:08 -07:00
Rob Moen
d2fc95fa52
Optimize getAnnotationsFrom dramatically by less object manipulation
...
Now returning an empty array when a non annotated character is found
in the range. No longer looping through each annotation, simply
comparing to previous characters annotations and trimming differences.
Write additional test.
Change-Id: I41d2422a931a74325693edca409aed6d5da20ba8
2012-05-14 16:40:49 -07:00
Trevor Parscal
e0de881a8a
Removed trailing whitespace in multi-line comment blocks
...
JSHint and various git tools complain about this, so let's just do away with them altogether
Change-Id: I731866bd21f1ee0088fb0a71df3abf92692aca23
2012-05-14 15:05:09 -07:00
Trevor Parscal
aa9148c9ee
Refactored ve.dm.TransactionProcessor tests to use data-providers
...
Change-Id: I0535f3ac56b6037712d731c71fc68c56ae7ea614
2012-05-14 14:32:34 -07:00
Rob Moen
b8302c715f
Rewrite getAnnotationsFromOffset to work with new Linear Model.
...
Properly init variables in getAnnotationsFromRange
Polish up tests.
Change-Id: Idc231998ce27e3a1c64363e862da22c837ea2ca2
2012-05-14 10:47:48 -07:00
Rob Moen
e05863b0dc
use proper assertion in getAnnotationsFromOffset
...
Change-Id: I41b5cfa3628d5a2ed6d3f59d157ebe372585059c
2012-05-14 09:58:30 -07:00
Trevor Parscal
6321821c86
Rewrote tests for ve.dm.Transaction to use a data provider
...
Change-Id: I7ecf09c627b96b4c84824152bd178fb36c1ce348
2012-05-11 16:49:31 -07:00
Rob Moen
7d8e06c78c
Fix up wrapping on getAnnotationsFromRange test
...
Change-Id: I793cd33b88f7c7f3a17d6fbfb80218438aa878af
2012-05-11 16:33:38 -07:00
Rob Moen
bd9a0b6fba
Rewrite DocumentFragment getAnnotationsFromRange method
...
Write unit tests for getAnnotationsFromRange
Change-Id: I82ff15e97378c07e5c555a72231da4161a72993c
2012-05-11 16:14:46 -07:00
Catrope
5b9a2645a6
Port getScope() from the old VE code and add tests for it
...
Change-Id: I8c34fed919e60fa1b8cb6a13cb9ca98f3e695421
2012-05-11 16:03:46 -07:00
Christian Williams
13f26682da
Removing data from annotations when empty, more tests for HTMLConverter
...
Change-Id: I3c3e234e9392e4afdcb4c8bc748aaa74a1fb30ca
2012-05-11 14:07:20 -07:00
Trevor Parscal
9cdfb84f9b
Added tests to getRelativeContentOffset
...
Also fixed a typo in the implementation
Change-Id: I86855795009e34d42a3a5857addc5ccb6366130f
2012-05-11 12:14:29 -07:00
Trevor Parscal
ae7b0c822b
Whitespace changes
...
Change-Id: I9ae27bee1207282d0f07d9a05584628cb8061683
2012-05-11 11:37:45 -07:00
Rob Moen
11a6ff67a7
Remove broken test, need to refactor
...
Change-Id: I7963454032eceec73cf5a5d71f4d3a173627bfc3
2012-05-11 10:33:52 -07:00
Rob Moen
469a55bde4
Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite
2012-05-11 10:31:12 -07:00
Rob Moen
ced54d06a9
Write better test for DocumentFragment getAnnotationsFromOffset
...
Fix errors in example test data
Remove whitespace
Change-Id: Ibb2b5c0851d6abac9974035753b95354b3c8dd5e
2012-05-11 10:29:09 -07:00
Catrope
7eeb6c7cac
Throw an exception when DocumentFragment gets unbalanced input
...
Change-Id: Ie891bd7ea4d9e9b1c84e7a0390f1af39c0e55fd4
2012-05-10 20:20:42 -07:00
Trevor Parscal
1475100a22
Ported isContentOffset, isStructuralOffset, isElementData, containsElementData and getRelativeContentOffset
...
Tests for all but getRelativeContentOffset are done too
Change-Id: Iee953647ec89e13259ae2a402c50c809f93bc655
2012-05-10 17:20:57 -07:00
Christian Williams
07b4534a4c
Basic test for HTMLConverter
...
Change-Id: Ie3fa3e036b92052305288c64edca8f404afded72
2012-05-10 16:28:45 -07:00
Trevor Parscal
1798a478e7
Massive refactor of node trees, generalizing lots of previously dm only stuff
...
Change-Id: I9dbb7094f86338ea2e725ad29f66e9e4ca2b52ed
2012-05-09 21:11:09 -07:00
Trevor Parscal
b4478216be
Added tests for document synchronizer
...
Change-Id: If114e3fc962598f7ea8f7f8ec8975a3b0d2d83e6
2012-05-09 18:31:09 -07:00
Trevor Parscal
2747ff05c5
Added basic test for ve.dm.DocumentSychronizer
...
Change-Id: Ieea96aaf0477b4d9ba7e59f5cf6f20f4b867a419
2012-05-09 17:13:55 -07:00
Rob Moen
d417c571a4
* Ported getAnnotationsFromOffset into DocumentFragment
...
* Wrote unit test for getAnnotationsFromOffset
Change-Id: Ie88b15ac6c16838b2d2bf9a2d83ca2952f5df817
2012-05-09 16:31:56 -07:00
Trevor Parscal
89a2b1bc40
Fixed naming in test moved from ve.dm.DocumentFragment to ve.dm.Document
...
Change-Id: I6843e452b0222632d1d244568bd75f3b229b4954
2012-05-09 15:30:18 -07:00
Trevor Parscal
c017d7421c
Removed use of expected in conjunction with ve.dm.example.*Equal methods
...
Change-Id: I48108f3fac7dda32344e105b7c52483cd2a84ef9
2012-05-09 15:28:06 -07:00
Catrope
22c88f77c3
Add a 'siblings' mode to selectNodes(), and add tests for it
...
Change-Id: Ib3fd3ee5aba7aab7c26193a2a9c48612f624862a
2012-05-08 18:31:50 -07:00
Trevor Parscal
123c64cbd5
Added more tests for selectNodes
...
Change-Id: Ibd9672fb9b6ce682905d20f9346fada6fb47b380
2012-05-07 19:03:59 -07:00
Catrope
4d9299b808
Fix bugs in selectNodes(), tests pass now
...
Also fix one instance of bad expected data in a selectNodes test
Change-Id: Ie226b237cf537143bce2f6b1e531b9067b140cb4
2012-05-07 17:03:42 -07:00
Catrope
32c65cdaa8
Change 'leaf' to 'leaves' and document it
...
Change-Id: I09d5995d3d9bf82670802f0efe849f40be2a18a3
2012-05-07 17:03:42 -07:00
Catrope
770775eec0
Fix rebuildNodes tests, were messing up ve.dm.example
...
Fixed by operating on a copy of the data instead
Change-Id: Ia2607d94f07b8d43e8c98ae8a94c34df90081508
2012-05-07 17:03:42 -07:00