Files @ 1d3594ffd14b
Branch filter:

Location: light9/web/rdfdb-synced-graph_test.html

drewp@bigasterisk.com
new home-status elt
<!doctype html>
<html>
  <head>
    <title>rdfdb-synced-graph test</title>
    <meta charset="utf-8">
    <script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js"></script>
    <script src="/node_modules/mocha/mocha.js"></script>
    <script src="/node_modules/chai/chai.js"></script>
    <link rel="stylesheet" media="all" href="/node_modules/mocha/mocha.css">
    <link rel="import" href="/lib/polymer/lib/elements/dom-bind.html">

    <link rel="import" href="rdfdb-synced-graph.html">
  </head>
  <body>
    <div id="mocha"><p><a href=".">Index</a></p></div>
    <div id="messages"></div>
    <div id="fixtures">
      <dom-bind>
        <template>
          <rdfdb-synced-graph id="graph" test-graph="true" graph="{{graph}}"></rdfdb-synced-graph>
        </template>
      </dom-bind>
    </div>
    
    <script>
     mocha.setup('bdd');
     const assert = chai.assert;
     
     describe("rdfdb-synced-graph", () => {
       let elem, U;
       beforeEach(() => {
         elem = document.querySelector("#graph");
         window.g = elem;
         elem.graph.clearGraph();
         U = elem.graph.Uri.bind(elem.graph);
       });
       it("makes a node", () => {
         assert.equal(elem.tagName, "RDFDB-SYNCED-GRAPH");
       });
       it("loads trig", (done) => {
         elem.graph.loadTrig(`
                       @prefix : <http://light9.bigasterisk.com/> .
                       :a :b :c :d .
                     `, () => {
                       assert.equal(elem.graph.quads().length, 1);
                       done();
                     });
       });
       describe("floatValue read call", () => {
         it("loads two values without confusing them in a cache", (done) => {
           elem.graph.loadTrig(`
               @prefix : <http://light9.bigasterisk.com/> .
               :s :a 1 :g .
               :s :b 2 :g .
             `, () => {
               assert.equal(elem.graph.floatValue(U(":s"), U(":a")), 1);
               assert.equal(elem.graph.floatValue(U(":s"), U(":b")), 2);
               assert.equal(elem.graph.floatValue(U(":s"), U(":a")), 1);
               done();
             });
         });
       });
     }); 
     mocha.run();
    </script>
  </body>
</html>