Permalink
Browse files

added more tests

  • Loading branch information...
1 parent 63daf21 commit 09f8ac9f0bf944e09b30c1d0cb06006d419a51ec @antoniogarrote committed Feb 4, 2012
Showing with 50 additions and 8 deletions.
  1. +4 −0 README.md
  2. +2 −2 build/output/knockout-latest.debug.js
  3. +1 −1 deps/sem_ko.js
  4. +1 −1 src/binding/bindingAttributeSyntax.js
  5. +15 −4 test3.html
  6. +6 −0 tests/index.html
  7. +21 −0 tests/tests.js
View
@@ -6,3 +6,7 @@ RDFStore-JS to handle the RDF/SPARQL data layer.
More documentation can be found here:
http://antoniogarrote.com/semantic_ko/
+
+A collection of small interactive examples is available here:
+
+http://antoniogarrote.github.com/semantic-ko/index.html
@@ -1347,7 +1347,7 @@ ko.exportSymbol('ko.jsonExpressionRewriting.insertPropertyReaderWritersIntoJson'
//@modified
//throw new Error("Unable to parse binding attribute.\nMessage: " + ex + ";\nAttribute value: " + attributeText);
}
- }
+ };
function invokeBindingHandler(handler, element, dataValue, allBindings, viewModel) {
handler(element, dataValue, allBindings, viewModel);
@@ -2456,7 +2456,7 @@ sko.log = function(msg) {
};
// Added a version identifier
-sko.VERSION = "0.1.0"
+sko.VERSION = "0.1.0";
/**
* JSON-LD utilities
View
@@ -38,7 +38,7 @@ sko.log = function(msg) {
};
// Added a version identifier
-sko.VERSION = "0.1.0"
+sko.VERSION = "0.1.0";
/**
* JSON-LD utilities
@@ -16,7 +16,7 @@
//@modified
//throw new Error("Unable to parse binding attribute.\nMessage: " + ex + ";\nAttribute value: " + attributeText);
}
- }
+ };
function invokeBindingHandler(handler, element, dataValue, allBindings, viewModel) {
handler(element, dataValue, allBindings, viewModel);
View
@@ -5,7 +5,6 @@
<script type='text/javascript' src='http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.js'></script>
<script type='text/javascript' src="./deps/rdf_store.js"></script>
<script type='text/javascript' src="./build/output/knockout-latest.debug.js"></script>
- <script type='text/javascript' src="./deps/sem_ko.js"></script>
</head>
<body>
@@ -17,9 +16,13 @@
<http://test.com/a> <http://test.com/related2> <http://test.com/d>.\
<http://test.com/c> <http://test.com/title> 'test resource c' ; <http://test.com/count> '3' .\
<http://test.com/d> <http://test.com/title> 'test resource d' ; <http://test.com/count> '4' .\
- <http://test.com/e> <http://test.com/title> 'test resource 3' ; <http://test.com/count> '2' .\
+ <http://test.com/e> <http://test.com/title> 'test resource e' ; <http://test.com/count> '2' .\
<http://test.com/e> <http://test.com/related1> <http://test.com/c>.\
- <http://test.com/e> <http://test.com/related2> <http://test.com/d>. }";
+ <http://test.com/e> <http://test.com/related2> <http://test.com/d>.\
+ <http://test.com/items/wittgenstein> <http://test.com/named> 'wittgenstein' .\
+ <http://test.com/items/russell> <http://test.com/named> 'russell' .\
+ <http://test.com/items/adorno> <http://test.com/named> 'adorno' .\
+ <http://test.com/items/popper> <http://test.com/named> 'popper' }";
var test = function() {
@@ -49,7 +52,7 @@
};
- sko.init(function(){
+ sko.ready(function(){
sko.store.execute(testData,
function(result, msg){
test();
@@ -76,5 +79,13 @@
<span data-bind='template: "test_template"'></span>
</div>
+ <script id='phiolosophers_template' type='text/html'>
+ {{each sko.where("{ ?subject <http://test.com/named> ?o }")()}}
+ <li about='${$value}' data-bind='text:<http://test.com/named>'></li>
+ {{/each}}
+ </script>
+
+ <ul id='philosphers-list' data-bind='template: "phiolosophers_template"'></ul>
+
</body>
</html>
View
@@ -226,5 +226,11 @@ <h2 id="qunit-userAgent"></h2>
<p class="nullified" data-bind='text: <http://test.com/property>'></p>
</span>
</div>
+
+ <div id='test28'>
+ <span about='<http://test.com/about1>'>
+ <a class="present" data-bind='attr: {href: [test:dst]}, text: [test:title]'></a>
+ </span>
+ </div>
</body>
</html>
View
@@ -740,4 +740,25 @@ asyncTest('testing bindings inside templates', function() {
});
});
});
+
+ asyncTest('test URIs inside complex binding expressions',function(){
+ var testData = "INSERT DATA { <http://test.com/about1> <http://test.com/title> 'a resource' ." +
+ "<http://test.com/about1> <http://test.com/dst> <http://destination.com> }";
+ var viewModel = {};
+
+ jQuery(document).ready(function(){
+ sko.ready(function(){
+ sko.rdf.prefixes.set("test", "http://test.com/");
+ sko.store.execute(testData, function(success, result){
+ ok(success);
+ sko.applyBindings('#test28', viewModel, function(){
+ ok(jQuery("#test28 a.present").text() === 'a resource');
+ ok(jQuery("#test28 a.present").attr("href") === 'http://destination.com');
+ jQuery("#test28").remove();
+ start();
+ });
+ });
+ });
+ });
+ });
});

0 comments on commit 09f8ac9

Please sign in to comment.