Commit graph

120 commits

Author SHA1 Message Date
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
Catrope 2008858830 Fix bug in selectNodes: input (0,0) returned []
This was because the while loop was never entered as end >= left was
true from the start. Convert the while loop to a do-while loop to make
sure it runs at least once

Change-Id: I9c6436a7b296e65a36b8301095b6edd00507d321
2012-05-14 21:41:08 -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 5708c0e02f Added transparent 1px image to make unit tests not show HTTP errors
Change-Id: I800e98ae6c47121ec652c34bd678e54e7efcb77c
2012-05-14 15:04:06 -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 6652f7573b Add indexInNode to selectNodes() output
This is for the case where we have a zero-length range in between two
siblings, and we need to know what index that corresponds to in order to
be able to insert nodes there (rebuildNodes() will use it for this
purpose)

Change-Id: I357d1cd665667a76f955a10b8d9d2810976cdbd7
2012-05-10 20:20:42 -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 081ec31ccd Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-10 16:58:47 -07:00
Christian Williams d1dbb32238 Fixing updateDomWrapper test
Change-Id: I93f5ceb96a9212652aa93eeebaf91ad1c5704ae5
2012-05-10 16:58:29 -07:00
Catrope 8834145f9e Fix nodeSelectionEqual() so it doesn't explode when a and b have unequal lengths
Change-Id: Idb84bc1238576c711a201cdbf05f63a7b603a819
2012-05-10 16:42:58 -07:00
Catrope 9b6402801a Fix the selectNodes() bug that Inez reported
Selecting a zero-length range at the start or end of a text node
(e.g. (1,1)) would return the text node's parent instead of the text
node

Change-Id: I7fe089bf66b93185dd3415eff53aa7e04e3ffdb2
2012-05-10 16:42:58 -07:00
Christian Williams 6e7c02a126 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-10 16:29:37 -07:00
Christian Williams 07b4534a4c Basic test for HTMLConverter
Change-Id: Ie3fa3e036b92052305288c64edca8f404afded72
2012-05-10 16:28:45 -07:00
Catrope 13b79d309c Add 'index' and 'nodeRange' to selectNodes() output
Change-Id: I38712545b713cc24663ebec3fe3e5c8741b4fad7
2012-05-10 15:03:23 -07:00
Catrope e137659722 Fix spelling of 'equivalent'
Change-Id: I0a444059c187ab5608aeca85a85c147ad1d69de6
2012-05-10 15:02:11 -07:00
Trevor Parscal 7168b4e041 Removed duplicate node rules from tests
These methods are wrappers for the model methods where the rules are actually being applied

Change-Id: I08be359010fa9fa81cd3a8aa5152083f92dc0b9c
2012-05-10 14:57:52 -07:00
Trevor Parscal 8d07a4e08c Fixed test so it doesn't break when nodes add classes in their constructors
Change-Id: Ib2f7bcedcf61a9b98da0e3e889f309f271483064
2012-05-10 14:55:13 -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