|
@@ -9,16 +9,16 @@ void main() {
|
|
|
test('create state tree', () async {
|
|
|
// final String response = await rootBundle.loadString('assets/document.json');
|
|
|
// final data = Map<String, Object>.from(json.decode(response));
|
|
|
- // final stateTree = StateTree.fromJson(data);
|
|
|
- // expect(stateTree.root.type, 'root');
|
|
|
- // expect(stateTree.root.toJson(), data['document']);
|
|
|
+ // final document = StateTree.fromJson(data);
|
|
|
+ // expect(document.root.type, 'root');
|
|
|
+ // expect(document.root.toJson(), data['document']);
|
|
|
});
|
|
|
|
|
|
test('search node by Path in state tree', () async {
|
|
|
// final String response = await rootBundle.loadString('assets/document.json');
|
|
|
// final data = Map<String, Object>.from(json.decode(response));
|
|
|
- // final stateTree = StateTree.fromJson(data);
|
|
|
- // final checkBoxNode = stateTree.root.childAtPath([1, 0]);
|
|
|
+ // final document = StateTree.fromJson(data);
|
|
|
+ // final checkBoxNode = document.root.childAtPath([1, 0]);
|
|
|
// expect(checkBoxNode != null, true);
|
|
|
// final textType = checkBoxNode!.attributes['text-type'];
|
|
|
// expect(textType != null, true);
|
|
@@ -27,8 +27,8 @@ void main() {
|
|
|
test('search node by Self in state tree', () async {
|
|
|
// final String response = await rootBundle.loadString('assets/document.json');
|
|
|
// final data = Map<String, Object>.from(json.decode(response));
|
|
|
- // final stateTree = StateTree.fromJson(data);
|
|
|
- // final checkBoxNode = stateTree.root.childAtPath([1, 0]);
|
|
|
+ // final document = StateTree.fromJson(data);
|
|
|
+ // final checkBoxNode = document.root.childAtPath([1, 0]);
|
|
|
// expect(checkBoxNode != null, true);
|
|
|
// final textType = checkBoxNode!.attributes['text-type'];
|
|
|
// expect(textType != null, true);
|
|
@@ -39,21 +39,21 @@ void main() {
|
|
|
test('insert node in state tree', () async {
|
|
|
// final String response = await rootBundle.loadString('assets/document.json');
|
|
|
// final data = Map<String, Object>.from(json.decode(response));
|
|
|
- // final stateTree = StateTree.fromJson(data);
|
|
|
+ // final document = StateTree.fromJson(data);
|
|
|
// final insertNode = Node.fromJson({
|
|
|
// 'type': 'text',
|
|
|
// });
|
|
|
- // bool result = stateTree.insert([1, 1], [insertNode]);
|
|
|
+ // bool result = document.insert([1, 1], [insertNode]);
|
|
|
// expect(result, true);
|
|
|
- // expect(identical(insertNode, stateTree.nodeAtPath([1, 1])), true);
|
|
|
+ // expect(identical(insertNode, document.nodeAtPath([1, 1])), true);
|
|
|
});
|
|
|
|
|
|
test('delete node in state tree', () async {
|
|
|
// final String response = await rootBundle.loadString('assets/document.json');
|
|
|
// final data = Map<String, Object>.from(json.decode(response));
|
|
|
- // final stateTree = StateTree.fromJson(data);
|
|
|
- // stateTree.delete([1, 1], 1);
|
|
|
- // final node = stateTree.nodeAtPath([1, 1]);
|
|
|
+ // final document = StateTree.fromJson(data);
|
|
|
+ // document.delete([1, 1], 1);
|
|
|
+ // final node = document.nodeAtPath([1, 1]);
|
|
|
// expect(node != null, true);
|
|
|
// expect(node!.attributes['tag'], '**');
|
|
|
});
|
|
@@ -61,10 +61,10 @@ void main() {
|
|
|
test('update node in state tree', () async {
|
|
|
// final String response = await rootBundle.loadString('assets/document.json');
|
|
|
// final data = Map<String, Object>.from(json.decode(response));
|
|
|
- // final stateTree = StateTree.fromJson(data);
|
|
|
- // final test = stateTree.update([1, 1], {'text-type': 'heading1'});
|
|
|
+ // final document = StateTree.fromJson(data);
|
|
|
+ // final test = document.update([1, 1], {'text-type': 'heading1'});
|
|
|
// expect(test, true);
|
|
|
- // final updatedNode = stateTree.nodeAtPath([1, 1]);
|
|
|
+ // final updatedNode = document.nodeAtPath([1, 1]);
|
|
|
// expect(updatedNode != null, true);
|
|
|
// expect(updatedNode!.attributes['text-type'], 'heading1');
|
|
|
});
|