aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-05-19 18:24:50 -0400
committerGitHub <noreply@github.com>2021-05-19 18:24:50 -0400
commiteddd0288643f08d2a2c85f73575bc7ee1c157539 (patch)
treebbcc7dd1279f4954324eccc34d6bf718ff1899aa /test
parentae89a8f2ad6274f77afbc0c8c202c0fbc0dc8757 (diff)
Add support for definitions with structured content (#1689)
* Add structured content to schema * Add support for generating custom content * Update importer * Update test data * Add verticalAlign property
Diffstat (limited to 'test')
-rw-r--r--test/data/dictionaries/valid-dictionary1/term_bank_1.json27
-rw-r--r--test/test-database.js4
2 files changed, 28 insertions, 3 deletions
diff --git a/test/data/dictionaries/valid-dictionary1/term_bank_1.json b/test/data/dictionaries/valid-dictionary1/term_bank_1.json
index 5094dd0f..a2c9a216 100644
--- a/test/data/dictionaries/valid-dictionary1/term_bank_1.json
+++ b/test/data/dictionaries/valid-dictionary1/term_bank_1.json
@@ -12,5 +12,30 @@
["画像", "がぞう", "n", "n", 1, ["gazou definition 1", {"type": "image", "path": "image.gif", "width": 350, "height": 350, "description": "gazou definition 2", "pixelated": true}], 5, "P E1"],
["読む", "よむ", "vt", "v5", 100, ["to read"], 6, "P E1"],
["強み", "つよみ", "n", "n", 90, ["strong point"], 7, "P E1"],
- ["テキスト", "テキスト", "n", "n", 1, ["text definition 1", {"type": "text", "text": "text definition 2"}], 8, "P E1"]
+ ["テキスト", "テキスト", "n", "n", 1, ["text definition 1", {"type": "text", "text": "text definition 2"}], 8, "P E1"],
+ [
+ "内容", "ないよう", "n", "n", 35,
+ [
+ "naiyou definition 1",
+ {"type": "structured-content", "content": "naiyou definition 2"},
+ {"type": "structured-content", "content": ["naiyou definition 3"]},
+ {"type": "structured-content", "content": {"tag": "img", "path": "image.gif", "width": 35, "height": 35, "pixelated": true}},
+ {"type": "structured-content", "content": [
+ "naiyou definition 5: ",
+ {"tag": "img", "path": "image.gif", "width": 35, "height": 35, "pixelated": true, "collapsible": false},
+ "\nmore content 1: ",
+ {"tag": "img", "path": "image.gif", "width": 35, "height": 35, "pixelated": true, "collapsible": true},
+ "\nmore content 2: ",
+ {"tag": "img", "path": "image.gif", "width": 35, "height": 35, "pixelated": true, "collapsible": false, "collapsed": false, "verticalAlign": "middle"},
+ " and ",
+ {"tag": "img", "path": "image.gif", "width": 35, "height": 35, "pixelated": true, "collapsible": false, "collapsed": true}
+ ]},
+ {"type": "structured-content", "content": [
+ "naiyou definition 6: ",
+ {"tag": "ruby", "content": ["内", {"tag": "rp", "content": "("}, {"tag": "rt", "content": "ない"}, {"tag": "rp", "content": ")"}]},
+ {"tag": "ruby", "content": ["容", {"tag": "rp", "content": "("}, {"tag": "rt", "content": "よう"}, {"tag": "rp", "content": ")"}]}
+ ]}
+ ],
+ 9, "P E1"
+ ]
] \ No newline at end of file
diff --git a/test/test-database.js b/test/test-database.js
index da4cc6d3..e68a39ba 100644
--- a/test/test-database.js
+++ b/test/test-database.js
@@ -162,8 +162,8 @@ async function testDatabase1() {
true
);
vm.assert.deepStrictEqual(counts, {
- counts: [{kanji: 2, kanjiMeta: 2, terms: 14, termMeta: 12, tagMeta: 15, media: 1}],
- total: {kanji: 2, kanjiMeta: 2, terms: 14, termMeta: 12, tagMeta: 15, media: 1}
+ counts: [{kanji: 2, kanjiMeta: 2, terms: 15, termMeta: 12, tagMeta: 15, media: 1}],
+ total: {kanji: 2, kanjiMeta: 2, terms: 15, termMeta: 12, tagMeta: 15, media: 1}
});
// Test find* functions