Commit graph

43 commits

Author SHA1 Message Date
Roan Kattouw 5ac817a6f4 Fix bugs in prepareContentAnnotation() related to structural offsets, and add a test. Also add parenthesis to the if statement mixing || and &&, for clarity 2011-11-24 16:27:40 +00:00
Roan Kattouw 6f3c407314 Introduce es.DocumentNode.getCommonAncestorPaths(), with tests 2011-11-24 15:34:12 +00:00
Trevor Parscal 3ed6544fe2 Added test that exposes bugs in prepareContentAnnotation 2011-11-23 23:24:05 +00:00
Trevor Parscal 8ed6ee5e3c Fixed a test which was poorly named and had incorrect data 2011-11-23 19:37:57 +00:00
Trevor Parscal 20da830a26 Rewrite of undo/redo - now completely implemented in es.SurfaceModel 2011-11-22 22:59:05 +00:00
Trevor Parscal 631323b9bd * Refactored es.HistoryModel to always be working from a single array rather than a buffer and an array
* Added support for associating a selection with a state
2011-11-21 23:51:37 +00:00
Trevor Parscal 779a63f486 * Switched to using JSON for hashing, allowing us to use the native JSON.stringify where available, which is much faster
* Added a bunch of utility functions for working with character data and annotations
* Got toolbar button states to follow selection of more than one character
2011-11-21 22:32:22 +00:00
Roan Kattouw 35a99b4be0 Make es.TransactionProcessor.remove() handle deep merges correctly, and add test cases. The code is still a bit rough and ugly and needs a bit more work, but I'll clean that up later; at least it works now. 2011-11-18 10:17:35 +00:00
Trevor Parscal 48e7f4c3c6 Initial checkin of new es.HistoryModel (needs tests) 2011-11-17 22:44:11 +00:00
Trevor Parscal 6fded56cec Renamed es.Transaction to es.TransactionModel 2011-11-17 22:42:18 +00:00
Roan Kattouw 117c785d85 Improve the merging logic in prepareRemoval() to also allow merging nested nodes, e.g. by deleting </p></li><li><p> 2011-11-17 19:23:15 +00:00
Roan Kattouw be994da373 Make selectNodes() also descend (recurse) into child nodes when only the start or only the end is in the middle of a child node. Without this, it was stuff like ranges with only openings and no closings. 2011-11-17 15:01:47 +00:00
Roan Kattouw 2c21250c70 Make selectNodes() not return an empty array when encountering a zero-length selection in a structural location (we don't do this for zero-length selections in content locations either, and the empty array is breaking an assumption I was making in my prepareRemoval rewrite) 2011-11-17 14:50:38 +00:00
Roan Kattouw ef478bfe7b Make the selectNodes tests log their failures to the console 2011-11-17 14:42:14 +00:00
Roan Kattouw e8899405e9 Fix bug in compare() which caused it to return true for arrays of unequal length (!!) 2011-11-17 14:21:39 +00:00
Trevor Parscal b89d7d7eeb Removed some accidental globals 2011-11-16 23:32:57 +00:00
Trevor Parscal cd033e02c4 Renamed es.DocumentNode.test to es.DocumentBranchNode.test to reflect it's contents 2011-11-16 19:35:18 +00:00
Trevor Parscal 607e0fe3ad Fixed test data in response to r103354 2011-11-16 19:26:16 +00:00
Roan Kattouw cb8a14b954 Add test cases to illustrate the breakage in r103271 2011-11-16 19:07:17 +00:00
Trevor Parscal 8a2e8b4aab Rewrote prepareRemoval to support dropping nodes that are considered droppable (not tableCells) and are covered completely by the range - otherwise nodes are stripped of content 2011-11-16 00:03:17 +00:00
Trevor Parscal 79ef19da42 Fixed documentation and use of es.arrayIndexOf to match the actual API of $.inArray (value, array, fromIndex). Renamed function to inArray to reduce confusion about how the function works. 2011-11-15 18:17:26 +00:00
Roan Kattouw c9d2bd84d1 Rewrite traverseLeafNodes tests using a data provider pattern 2011-11-15 14:35:03 +00:00
Roan Kattouw 2a80194223 Add more tests 2011-11-15 13:50:24 +00:00
Roan Kattouw fee2d48b2b Add very basic implementation of traverseNodes(), with tests. This doesn't respect the from parameter (so tests 3-6 fail); I will rewrite it from recursive to iterative so it can support that. 2011-11-15 11:12:06 +00:00
Roan Kattouw 8563e7e451 Add FIXME comment for a failing test and fix a typo in its description 2011-11-15 10:15:52 +00:00
Trevor Parscal ff07930171 Added test for prepareRemoval which fails atm, because strip doesn't drop nodes that are covered completely. Also cleaned up some comments in prepareRemoval 2011-11-15 01:15:21 +00:00
Trevor Parscal 482d477449 Added test for prepareRemoval which fails atm, because strip doesn't drop nodes that are covered completely. 2011-11-15 01:04:37 +00:00
Trevor Parscal ba64cfaf46 Moved tests for es.TransactionProcessor to their own file 2011-11-14 23:10:00 +00:00
Trevor Parscal 2494c40297 Moved transaction processing code to new class, es.TransactionProcessor 2011-11-14 23:04:36 +00:00
Trevor Parscal 713a80596d Added es.DocumentLeafNode, which like es.DocumentBranchNode is a mixin-like class (we may want to switch to using a more natural composition mechanism than es.extendClass in the future) - now es.DocumentNode also has an abstract method called hasChildren which returns a boolean and can indicate if a node is a leaf or a branch. 2011-11-10 19:26:02 +00:00
Roan Kattouw a4f71ace69 Rewrite the remove() function in es.DocumentModel.operations such that the tests added in r102564 pass now 2011-11-10 15:50:59 +00:00
Roan Kattouw aa7a6e2605 Add globalRange property to the output of selectNodes(), which translates the range property to be relative to the root rather than to the node. Update tests for this, and fix the test case numbering for selectNodes 2011-11-10 13:15:55 +00:00
Trevor Parscal 4bf41fc3e8 Updated tests and test data to support listItem nodes being branches instead of leafs 2011-11-09 23:39:47 +00:00
Roan Kattouw 25a04133b0 Add test cases for inserting a paragraph break (</p><p>) in the middle of a paragraph. Interestingly, committing this insertion actually works, but rolling it back doesn't. 2011-11-09 20:24:13 +00:00
Trevor Parscal cd18698bbc Moved es.DocumentModelBranchNode tests to their own file 2011-11-04 21:16:20 +00:00
Trevor Parscal add7c23191 Added es.Transaction.optimize and added in a test that neilk sent a patch for 2011-11-04 20:38:47 +00:00
Roan Kattouw 124a36b942 Add a metric ton of (mostly generated) selectNodes tests, and change selectNodes a little bit to make them pass 2011-11-04 20:27:23 +00:00
Roan Kattouw 84c6b8925a Refactor the large data objects in es.DocumentModel.test.js out to es.testData.js so they can be shared with other tests 2011-11-04 20:11:51 +00:00
Trevor Parscal 04b7e80096 Prepare removal tests are working now that DocumentModelNode objects have a type property 2011-11-04 18:31:22 +00:00
Trevor Parscal 4963b05e14 Split tests up by method 2011-11-04 18:08:51 +00:00
Trevor Parscal 4d7cbded2c Minor cleanup 2011-11-04 17:54:02 +00:00
Trevor Parscal b6420fd327 Changed from using the Hype code-name to EditSurface 2011-11-04 17:47:54 +00:00
Trevor Parscal 36c6bee0a8 Moved es tests to their own folder 2011-11-04 17:47:09 +00:00