Mercurial > code > home > repos > light9
annotate web/rdfdb-synced-graph_test.html @ 2400:9a4bc2ea264e
ui tweaks and link fix
author | drewp@bigasterisk.com |
---|---|
date | Fri, 17 May 2024 13:25:46 -0700 |
parents | 4556eebe5d73 |
children |
rev | line source |
---|---|
1714
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
1 <!doctype html> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
2 <html> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
3 <head> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
4 <title>rdfdb-synced-graph test</title> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
5 <meta charset="utf-8"> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
6 <script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js"></script> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
7 <script src="/node_modules/mocha/mocha.js"></script> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
8 <script src="/node_modules/chai/chai.js"></script> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
9 <link rel="stylesheet" media="all" href="/node_modules/mocha/mocha.css"> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
10 <link rel="import" href="/lib/polymer/lib/elements/dom-bind.html"> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
11 |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
12 <link rel="import" href="rdfdb-synced-graph.html"> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
13 </head> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
14 <body> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
15 <div id="mocha"><p><a href=".">Index</a></p></div> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
16 <div id="messages"></div> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
17 <div id="fixtures"> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
18 <dom-bind> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
19 <template> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
20 <rdfdb-synced-graph id="graph" test-graph="true" graph="{{graph}}"></rdfdb-synced-graph> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
21 </template> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
22 </dom-bind> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
23 </div> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
24 |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
25 <script> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
26 mocha.setup('bdd'); |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
27 const assert = chai.assert; |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
28 |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
29 describe("rdfdb-synced-graph", () => { |
1725 | 30 let elem, U; |
31 beforeEach(() => { | |
32 elem = document.querySelector("#graph"); | |
33 window.g = elem; | |
34 elem.graph.clearGraph(); | |
35 U = elem.graph.Uri.bind(elem.graph); | |
36 }); | |
37 it("makes a node", () => { | |
38 assert.equal(elem.tagName, "RDFDB-SYNCED-GRAPH"); | |
39 }); | |
40 it("loads trig", (done) => { | |
41 elem.graph.loadTrig(` | |
42 @prefix : <http://light9.bigasterisk.com/> . | |
1714
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
43 :a :b :c :d . |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
44 `, () => { |
1725 | 45 assert.equal(elem.graph.quads().length, 1); |
46 done(); | |
1714
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
47 }); |
1725 | 48 }); |
49 describe("floatValue read call", () => { | |
50 it("loads two values without confusing them in a cache", (done) => { | |
51 elem.graph.loadTrig(` | |
52 @prefix : <http://light9.bigasterisk.com/> . | |
53 :s :a 1 :g . | |
54 :s :b 2 :g . | |
55 `, () => { | |
56 assert.equal(elem.graph.floatValue(U(":s"), U(":a")), 1); | |
57 assert.equal(elem.graph.floatValue(U(":s"), U(":b")), 2); | |
58 assert.equal(elem.graph.floatValue(U(":s"), U(":a")), 1); | |
59 done(); | |
60 }); | |
1714
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
61 }); |
1725 | 62 }); |
1714
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
63 }); |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
64 mocha.run(); |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
65 </script> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
66 </body> |
f2265601ead6
edit-choice/etc fixes and tests
Drew Perttula <drewp@bigasterisk.com>
parents:
diff
changeset
|
67 </html> |