Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also check doc against an invariant after a new op has been applied.
- Loading branch information
Michael Aufreiter
committed
Sep 19, 2012
1 parent
e0140fd
commit 1e67b0c
Showing
6 changed files
with
159 additions
and
78 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"document": { | ||
"refs": { | ||
"master": "op-3", | ||
"patch-1": "op-4" | ||
}, | ||
"operations": { | ||
"op-1": { | ||
"op": ["insert", {"id": "section:hello", "type": "section", "properties": {"content": "Hello?"}}], | ||
"user": "michael", | ||
"parent": null | ||
}, | ||
|
||
"op-2": { | ||
"op": ["insert", {"id": "text:hello", "type": "text", "target": "section:hello", "properties": {"content": "Helo wrld"}}], | ||
"user": "michael", | ||
"parent": "op-1" | ||
}, | ||
|
||
"op-3": { | ||
"op": ["insert", {"id": "text:p1", "type": "text", "target": "text:hello", "properties": {"content": "Ein erster Paragraph."}}], | ||
"user": "michael", | ||
"parent": "op-2" | ||
}, | ||
|
||
"op-4": { | ||
"op": ["insert", {"id": "text:outro", "type": "text", "target": "text:hello", "properties": {"content": "This is the end."}}], | ||
"user": "michael", | ||
"parent": "op-3" | ||
} | ||
} | ||
}, | ||
"annotations": { | ||
"refs": { | ||
"master": "third-op", | ||
"op-3": "third-op" | ||
}, | ||
"operations": { | ||
"first-op": { | ||
"op": ["insert", {"id": "annotation:1", "type": "em", "properties": {"nodes": ["text:hello"], "pos": [0,4]}}], | ||
"user": "michael", | ||
"parent": null | ||
}, | ||
"second-op": { | ||
"op": ["insert", {"id": "annotation:2", "node": "text:hello", "type": "comment", "properties": {"content": "Hello", "nodes": ["text:hello"], "pos": [5,9]} }], | ||
"user": "michael", | ||
"parent": "first-op" | ||
}, | ||
"third-op": { | ||
"op": ["insert", {"id": "annotation:3", "node": "text:hello", "type": "comment", "properties": {"content": "USS New Ironsides was a wooden-hulled broadside ironclad built for the United States Navy during the American Civil War.", "nodes": ["text:p1"], "pos": [0,4]} }], | ||
"user": "john", | ||
"parent": "second-op" | ||
} | ||
} | ||
}, | ||
"ref": "master" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var _ = require('underscore'); | ||
var fs = require('fs'); | ||
var assert = require('assert'); | ||
var Document = require('../document').Document; | ||
var schema = JSON.parse(fs.readFileSync(__dirname+ '/../data/substance.json', 'utf-8')); | ||
|
||
var emptyDoc = JSON.parse(fs.readFileSync(__dirname+ '/fixtures/busy_doc.json', 'utf-8')); | ||
|
||
// Just runs all the ops and checks the doc state against an invariant all the time. | ||
var doc = new Document(emptyDoc, schema); | ||
|