1 if(!dojo._hasResource["dojox.data.tests.stores.XmlStore"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dojox.data.tests.stores.XmlStore"] = true;
3 dojo.provide("dojox.data.tests.stores.XmlStore");
4 dojo.require("dojox.data.XmlStore");
5 dojo.require("dojo.data.api.Read");
6 dojo.require("dojo.data.api.Write");
9 dojox.data.tests.stores.XmlStore.getBooks2Store = function(){
10 return new dojox.data.XmlStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books2.xml").toString(), label: "title"});
13 dojox.data.tests.stores.XmlStore.getBooksStore = function(){
14 return new dojox.data.XmlStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books.xml").toString(), label: "title"});
17 doh.register("dojox.data.tests.stores.XmlStore",
19 function testReadAPI_fetch_all(t){
21 // Simple test of fetching all xml items through an XML element called isbn
23 // Simple test of fetching all xml items through an XML element called isbn
24 var store = dojox.data.tests.stores.XmlStore.getBooksStore();
26 var d = new doh.Deferred();
27 function onComplete(items, request) {
28 t.assertEqual(20, items.length);
31 function onError(error, request) {
34 store.fetch({query:{isbn:"*"}, onComplete: onComplete, onError: onError});
37 function testReadAPI_fetch_one(t){
39 // Simple test of fetching one xml items through an XML element called isbn
41 // Simple test of fetching one xml items through an XML element called isbn
42 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
44 var d = new doh.Deferred();
45 function onComplete(items, request) {
46 t.assertEqual(1, items.length);
49 function onError(error, request) {
52 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
56 name: "testReadAPI_fetch_paging",
60 // Simple test of fetching one xml items through an XML element called isbn
62 // Simple test of fetching one xml items through an XML element called isbn
63 var store = dojox.data.tests.stores.XmlStore.getBooksStore();
64 var d = new doh.Deferred();
65 function dumpFirstFetch(items, request){
66 t.assertEqual(5, items.length);
69 request.onComplete = dumpSecondFetch;
73 function dumpSecondFetch(items, request){
74 t.assertEqual(1, items.length);
77 request.onComplete = dumpThirdFetch;
81 function dumpThirdFetch(items, request){
82 t.assertEqual(5, items.length);
85 request.onComplete = dumpFourthFetch;
89 function dumpFourthFetch(items, request){
90 t.assertEqual(18, items.length);
93 request.onComplete = dumpFifthFetch;
97 function dumpFifthFetch(items, request){
98 t.assertEqual(11, items.length);
101 request.onComplete = dumpSixthFetch;
102 store.fetch(request);
105 function dumpSixthFetch(items, request){
106 t.assertEqual(18, items.length);
110 function completed(items, request){
111 t.assertEqual(20, items.length);
114 request.onComplete = dumpFirstFetch;
115 store.fetch(request);
118 function error(errData, request){
122 store.fetch({onComplete: completed, onError: error});
126 function testReadAPI_fetch_pattern0(t){
128 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match
130 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match
131 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
132 var d = new doh.Deferred();
133 function onComplete(items, request) {
134 t.assertEqual(1, items.length);
137 function onError(error, request) {
140 store.fetch({query:{isbn:"?9B574"}, onComplete: onComplete, onError: onError});
143 function testReadAPI_fetch_pattern1(t){
145 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match
147 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match
148 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
149 var d = new doh.Deferred();
150 function onComplete(items, request) {
151 t.assertEqual(4, items.length);
154 function onError(error, request) {
157 store.fetch({query:{isbn:"A9B57?"}, onComplete: onComplete, onError: onError});
160 function testReadAPI_fetch_pattern2(t){
162 // Simple test of fetching one xml items through an XML element called isbn with * pattern match
164 // Simple test of fetching one xml items through an XML element called isbn with * pattern match
165 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
166 var d = new doh.Deferred();
167 function onComplete(items, request) {
168 t.assertEqual(5, items.length);
171 function onError(error, request) {
174 store.fetch({query:{isbn:"A9*"}, onComplete: onComplete, onError: onError});
177 function testReadAPI_fetch_pattern_caseInsensitive(t){
179 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case insensitive mode.
181 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case insensitive mode.
182 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
183 var d = new doh.Deferred();
184 function onComplete(items, request) {
185 t.assertEqual(1, items.length);
188 function onError(error, request) {
191 store.fetch({query:{isbn:"?9b574"}, queryOptions: {ignoreCase: true}, onComplete: onComplete, onError: onError});
194 function testReadAPI_fetch_pattern_caseSensitive(t){
196 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case sensitive mode.
198 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match and in case sensitive mode.
199 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
200 var d = new doh.Deferred();
201 function onComplete(items, request) {
202 t.assertEqual(1, items.length);
205 function onError(error, request) {
208 store.fetch({query:{isbn:"?9B574"}, queryOptions: {ignoreCase: false}, onComplete: onComplete, onError: onError});
211 function testReadAPI_fetch_all_rootItem(t){
213 // Simple test of fetching all xml items through an XML element called isbn
215 // Simple test of fetching all xml items through an XML element called isbn
216 var store = new dojox.data.XmlStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books3.xml").toString(),
219 var d = new doh.Deferred();
220 function onComplete(items, request) {
221 t.assertEqual(5, items.length);
224 function onError(error, request) {
227 store.fetch({query:{isbn:"*"}, onComplete: onComplete, onError: onError});
230 function testReadAPI_fetch_withAttrMap_all(t){
231 var store = new dojox.data.XmlStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books_isbnAttr.xml").toString(),
232 attributeMap: {"book.isbn": "@isbn"}});
234 var d = new doh.Deferred();
235 function onComplete(items, request) {
236 t.assertEqual(5, items.length);
239 function onError(error, request) {
240 console.debug(error);
243 store.fetch({query:{isbn:"*"}, onComplete: onComplete, onError: onError});
246 function testReadAPI_fetch_withAttrMap_one(t){
247 var store = new dojox.data.XmlStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books_isbnAttr.xml").toString(),
248 attributeMap: {"book.isbn": "@isbn"}});
250 var d = new doh.Deferred();
251 function onComplete(items, request) {
252 t.assertEqual(1, items.length);
255 function onError(error, request) {
256 console.debug(error);
259 store.fetch({query:{isbn:"2"}, onComplete: onComplete, onError: onError});
262 function testReadAPI_fetch_withAttrMap_pattern0(t){
264 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match
266 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match
267 var store = new dojox.data.XmlStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books_isbnAttr2.xml").toString(),
268 attributeMap: {"book.isbn": "@isbn"}});
269 var d = new doh.Deferred();
270 function onComplete(items, request) {
271 t.assertEqual(3, items.length);
274 function onError(error, request) {
277 store.fetch({query:{isbn:"ABC?"}, onComplete: onComplete, onError: onError});
280 function testReadAPI_fetch_withAttrMap_pattern1(t){
282 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match
284 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match
285 var store = new dojox.data.XmlStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books_isbnAttr2.xml").toString(),
286 attributeMap: {"book.isbn": "@isbn"}});
287 var d = new doh.Deferred();
288 function onComplete(items, request) {
289 t.assertEqual(5, items.length);
292 function onError(error, request) {
295 store.fetch({query:{isbn:"A*"}, onComplete: onComplete, onError: onError});
298 function testReadAPI_fetch_withAttrMap_pattern2(t){
300 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match
302 // Simple test of fetching one xml items through an XML element called isbn with ? pattern match
303 var store = new dojox.data.XmlStore({url: dojo.moduleUrl("dojox.data.tests", "stores/books_isbnAttr2.xml").toString(),
304 attributeMap: {"book.isbn": "@isbn"}});
305 var d = new doh.Deferred();
306 function onComplete(items, request) {
307 t.assertEqual(2, items.length);
310 function onError(error, request) {
313 store.fetch({query:{isbn:"?C*"}, onComplete: onComplete, onError: onError});
317 function testReadAPI_getLabel(t){
319 // Simple test of the getLabel function against a store set that has a label defined.
321 // Simple test of the getLabel function against a store set that has a label defined.
323 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
325 var d = new doh.Deferred();
326 function onComplete(items, request){
327 t.assertEqual(items.length, 1);
328 var label = store.getLabel(items[0]);
329 t.assertTrue(label !== null);
330 t.assertEqual("Title of 4", label);
333 function onError(error, request) {
336 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
339 function testReadAPI_getLabelAttributes(t){
341 // Simple test of the getLabelAttributes function against a store set that has a label defined.
343 // Simple test of the getLabelAttributes function against a store set that has a label defined.
345 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
347 var d = new doh.Deferred();
348 function onComplete(items, request){
349 t.assertEqual(items.length, 1);
350 var labelList = store.getLabelAttributes(items[0]);
351 t.assertTrue(dojo.isArray(labelList));
352 t.assertEqual("title", labelList[0]);
355 function onError(error, request) {
358 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
362 function testReadAPI_getValue(t){
364 // Simple test of the getValue API
366 // Simple test of the getValue API
367 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
369 var d = new doh.Deferred();
370 function onComplete(items, request) {
371 t.assertEqual(1, items.length);
373 t.assertTrue(store.hasAttribute(item,"isbn"));
374 t.assertEqual(store.getValue(item,"isbn"), "A9B574");
377 function onError(error, request) {
380 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
383 function testReadAPI_getValues(t){
385 // Simple test of the getValues API
387 // Simple test of the getValues API
388 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
390 var d = new doh.Deferred();
391 function onComplete(items, request) {
392 t.assertEqual(1, items.length);
394 t.assertTrue(store.hasAttribute(item,"isbn"));
395 var values = store.getValues(item,"isbn");
396 t.assertEqual(1,values.length);
397 t.assertEqual("A9B574", values[0]);
400 function onError(error, request) {
403 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
406 function testReadAPI_isItem(t){
408 // Simple test of the isItem API
410 // Simple test of the isItem API
411 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
413 var d = new doh.Deferred();
414 function onComplete(items, request) {
415 t.assertEqual(1, items.length);
417 t.assertTrue(store.isItem(item));
418 t.assertTrue(!store.isItem({}));
419 t.assertTrue(!store.isItem("Foo"));
420 t.assertTrue(!store.isItem(1));
423 function onError(error, request) {
426 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
429 function testReadAPI_isItem_multistore(t){
431 // Simple test of the isItem API across multiple store instances.
433 // Simple test of the isItem API across multiple store instances.
434 var store1 = dojox.data.tests.stores.XmlStore.getBooks2Store();
435 var store2 = dojox.data.tests.stores.XmlStore.getBooks2Store();
437 var d = new doh.Deferred();
438 function onComplete1(items, request) {
439 t.assertEqual(1, items.length);
440 var item1 = items[0];
441 t.assertTrue(store1.isItem(item1));
443 function onComplete2(items, request) {
444 t.assertEqual(1, items.length);
445 var item2 = items[0];
446 t.assertTrue(store2.isItem(item2));
447 t.assertTrue(!store1.isItem(item2));
448 t.assertTrue(!store2.isItem(item1));
451 store2.fetch({query:{isbn:"A9B574"}, onComplete: onComplete2, onError: onError});
453 function onError(error, request) {
456 store1.fetch({query:{isbn:"A9B574"}, onComplete: onComplete1, onError: onError});
459 function testReadAPI_hasAttribute(t){
461 // Simple test of the hasAttribute API
463 // Simple test of the hasAttribute API
464 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
466 var d = new doh.Deferred();
467 function onComplete(items, request) {
468 t.assertEqual(1, items.length);
470 t.assertTrue(store.hasAttribute(item,"isbn"));
471 t.assertTrue(!store.hasAttribute(item,"bob"));
474 function onError(error, request) {
477 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
480 function testReadAPI_containsValue(t){
482 // Simple test of the containsValue API
484 // Simple test of the containsValue API
485 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
487 var d = new doh.Deferred();
488 function onComplete(items, request) {
489 t.assertEqual(1, items.length);
491 t.assertTrue(store.containsValue(item,"isbn", "A9B574"));
492 t.assertTrue(!store.containsValue(item,"isbn", "bob"));
495 function onError(error, request) {
498 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
501 function testReadAPI_sortDescending(t){
503 // Simple test of the sorting API in descending order.
505 // Simple test of the sorting API in descending order.
506 var store = dojox.data.tests.stores.XmlStore.getBooksStore();
508 //Comparison is done as a string type (toString comparison), so the order won't be numeric
509 //So have to compare in 'alphabetic' order.
510 var order = [9,8,7,6,5,4,3,20,2,19,18,17,16,15,14,13,12,11,10,1];
512 var d = new doh.Deferred();
513 function onComplete(items, request) {
514 console.log("Number of items: " + items.length);
515 t.assertEqual(20, items.length);
517 for(var i = 0; i < items.length; i++){
518 t.assertEqual(order[i], store.getValue(items[i],"isbn").toString());
522 function onError(error, request) {
526 var sortAttributes = [{attribute: "isbn", descending: true}];
527 store.fetch({query:{isbn:"*"}, sort: sortAttributes, onComplete: onComplete, onError: onError});
530 function testReadAPI_sortAscending(t){
532 // Simple test of the sorting API in ascending order.
534 // Simple test of the sorting API in ascending order.
535 var store = dojox.data.tests.stores.XmlStore.getBooksStore();
537 //Comparison is done as a string type (toString comparison), so the order won't be numeric
538 //So have to compare in 'alphabetic' order.
539 var order = [1,10,11,12,13,14,15,16,17,18,19,2,20,3,4,5,6,7,8,9];
541 var d = new doh.Deferred();
542 function onComplete(items, request) {
543 t.assertEqual(20, items.length);
545 for(var i = 0; i < items.length; i++){
546 t.assertEqual(order[i], store.getValue(items[i],"isbn").toString());
550 function onError(error, request) {
554 var sortAttributes = [{attribute: "isbn"}];
555 store.fetch({query:{isbn:"*"}, sort: sortAttributes, onComplete: onComplete, onError: onError});
558 function testReadAPI_sortDescendingNumeric(t){
560 // Simple test of the sorting API in descending order using a numeric comparator.
562 // Simple test of the sorting API in descending order using a numeric comparator.
563 var store = dojox.data.tests.stores.XmlStore.getBooksStore();
565 //isbn should be treated as a numeric, not as a string comparison
566 store.comparatorMap = {};
567 store.comparatorMap["isbn"] = function(a, b){
569 if(parseInt(a.toString()) > parseInt(b.toString())){
571 }else if(parseInt(a.toString()) < parseInt(b.toString())){
574 return ret; //int, {-1,0,1}
577 var d = new doh.Deferred();
578 function onComplete(items, request) {
579 t.assertEqual(20, items.length);
581 for(var i = 0; i < items.length; i++){
582 t.assertEqual(itemId, store.getValue(items[i],"isbn").toString());
587 function onError(error, request) {
591 var sortAttributes = [{attribute: "isbn", descending: true}];
592 store.fetch({query:{isbn:"*"}, sort: sortAttributes, onComplete: onComplete, onError: onError});
595 function testReadAPI_sortAscendingNumeric(t){
597 // Simple test of the sorting API in ascending order using a numeric comparator.
599 // Simple test of the sorting API in ascending order using a numeric comparator.
600 var store = dojox.data.tests.stores.XmlStore.getBooksStore();
602 //isbn should be treated as a numeric, not as a string comparison
603 store.comparatorMap = {};
604 store.comparatorMap["isbn"] = function(a, b){
606 if(parseInt(a.toString()) > parseInt(b.toString())){
608 }else if(parseInt(a.toString()) < parseInt(b.toString())){
611 return ret; //int, {-1,0,1}
614 var d = new doh.Deferred();
615 function onComplete(items, request) {
616 t.assertEqual(20, items.length);
618 for(var i = 0; i < items.length; i++){
619 t.assertEqual(itemId, store.getValue(items[i],"isbn").toString());
624 function onError(error, request) {
628 var sortAttributes = [{attribute: "isbn"}];
629 store.fetch({query:{isbn:"*"}, sort: sortAttributes, onComplete: onComplete, onError: onError});
632 function testReadAPI_isItemLoaded(t){
634 // Simple test of the isItemLoaded API
636 // Simple test of the isItemLoaded API
637 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
639 var d = new doh.Deferred();
640 function onComplete(items, request) {
641 t.assertEqual(1, items.length);
643 t.assertTrue(store.isItemLoaded(item));
646 function onError(error, request) {
649 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
652 function testReadAPI_getFeatures(t){
654 // Simple test of the getFeatures function of the store
656 // Simple test of the getFeatures function of the store
658 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
659 var features = store.getFeatures();
662 t.assertTrue((i === "dojo.data.api.Read" || i === "dojo.data.api.Write"));
665 t.assertEqual(2, count);
667 function testReadAPI_getAttributes(t){
669 // Simple test of the getAttributes API
671 // Simple test of the getAttributes API
672 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
674 var d = new doh.Deferred();
675 function onComplete(items, request) {
676 t.assertEqual(1, items.length);
678 var attributes = store.getAttributes(item);
680 //Should be six, as all items should have tagName, childNodes, and text() special attributes
681 //in addition to any doc defined ones, which in this case are author, title, and isbn
682 //FIXME: Figure out why IE returns 5! Need to get firebug lite working in IE for that.
683 //Suspect it's childNodes, may not be defined if there are no child nodes.
684 for(var i = 0; i < attributes.length; i++){
685 console.log("attribute found: " + attributes[i]);
688 t.assertEqual(5,attributes.length);
690 t.assertEqual(6,attributes.length);
694 function onError(error, request) {
697 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
700 function testWriteAPI_setValue(t){
702 // Simple test of the setValue API
704 // Simple test of the setValue API
705 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
707 var d = new doh.Deferred();
708 function onComplete(items, request) {
709 t.assertEqual(1, items.length);
711 t.assertTrue(store.containsValue(item,"isbn", "A9B574"));
712 store.setValue(item, "isbn", "A9B574-new");
713 t.assertEqual(store.getValue(item,"isbn").toString(), "A9B574-new");
716 function onError(error, request) {
719 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
722 function testWriteAPI_setValues(t){
724 // Simple test of the setValues API
726 // Simple test of the setValues API
727 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
729 var d = new doh.Deferred();
730 function onComplete(items, request) {
731 t.assertEqual(1, items.length);
733 t.assertTrue(store.containsValue(item,"isbn", "A9B574"));
734 store.setValues(item, "isbn", ["A9B574-new1", "A9B574-new2"]);
735 var values = store.getValues(item,"isbn");
736 t.assertEqual(values[0].toString(), "A9B574-new1");
737 t.assertEqual(values[1].toString(), "A9B574-new2");
738 store.setValues(values[0], "text()", ["A9B574", "-new3"]);
739 t.assertEqual(store.getValue(values[0],"text()").toString(), "A9B574-new3");
742 function onError(error, request) {
745 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
748 function testWriteAPI_unsetAttribute(t){
750 // Simple test of the unsetAttribute API
752 // Simple test of the unsetAttribute API
753 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
755 var d = new doh.Deferred();
756 function onComplete(items, request) {
757 t.assertEqual(1, items.length);
759 t.assertTrue(store.containsValue(item,"isbn", "A9B574"));
760 store.unsetAttribute(item,"isbn");
761 t.assertTrue(!store.hasAttribute(item,"isbn"));
762 t.assertTrue(store.isDirty(item));
765 function onError(error, request) {
768 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
771 function testWriteAPI_isDirty(t){
773 // Simple test of the isDirty API
775 // Simple test of the isDirty API
776 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
778 var d = new doh.Deferred();
779 function onComplete(items, request) {
780 t.assertEqual(1, items.length);
782 t.assertTrue(store.containsValue(item,"isbn", "A9B574"));
783 store.setValue(item, "isbn", "A9B574-new");
784 t.assertEqual(store.getValue(item,"isbn").toString(), "A9B574-new");
785 t.assertTrue(store.isDirty(item));
788 function onError(error, request) {
791 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
794 function testWriteAPI_revert(t){
796 // Simple test of the isDirty API
798 // Simple test of the isDirty API
799 var store = dojox.data.tests.stores.XmlStore.getBooks2Store();
801 var d = new doh.Deferred();
802 function onComplete(items, request) {
803 t.assertEqual(1, items.length);
805 t.assertTrue(store.containsValue(item,"isbn", "A9B574"));
806 t.assertTrue(!store.isDirty(item));
807 store.setValue(item, "isbn", "A9B574-new");
808 t.assertEqual(store.getValue(item,"isbn").toString(), "A9B574-new");
809 t.assertTrue(store.isDirty(item));
812 //Fetch again to see if it reset the state.
813 function onComplete1(items, request) {
814 t.assertEqual(1, items.length);
816 t.assertTrue(store.containsValue(item,"isbn", "A9B574"));
819 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete1, onError: onError});
821 function onError(error, request) {
824 store.fetch({query:{isbn:"A9B574"}, onComplete: onComplete, onError: onError});
827 function testReadAPI_functionConformance(t){
829 // Simple test read API conformance. Checks to see all declared functions are actual functions on the instances.
831 // Simple test read API conformance. Checks to see all declared functions are actual functions on the instances.
833 var testStore = dojox.data.tests.stores.XmlStore.getBooksStore();
834 var readApi = new dojo.data.api.Read();
838 var member = readApi[i];
839 //Check that all the 'Read' defined functions exist on the test store.
840 if(typeof member === "function"){
841 var testStoreMember = testStore[i];
842 if(!(typeof testStoreMember === "function")){
843 console.log("Problem with function: [" + i + "]");
849 t.assertTrue(passed);
851 function testWriteAPI_functionConformance(t){
853 // Simple test write API conformance. Checks to see all declared functions are actual functions on the instances.
855 // Simple test write API conformance. Checks to see all declared functions are actual functions on the instances.
857 var testStore = dojox.data.tests.stores.XmlStore.getBooksStore();
858 var writeApi = new dojo.data.api.Write();
862 var member = writeApi[i];
863 //Check that all the 'Write' defined functions exist on the test store.
864 if(typeof member === "function"){
865 var testStoreMember = testStore[i];
866 if(!(typeof testStoreMember === "function")){
872 t.assertTrue(passed);