diff --git a/test/base.js b/test/base.js new file mode 100644 index 00000000..2d8df709 --- /dev/null +++ b/test/base.js @@ -0,0 +1,16 @@ +var Fixture = { + getDataset: function() { + var fields = [{id: 'x'}, {id: 'y'}, {id: 'z'}, {id: 'country'}, {id: 'label'},{id: 'lat'},{id: 'lon'}]; + var documents = [ + {id: 0, x: 1, y: 2, z: 3, country: 'DE', lat:52.56, lon:13.40} + , {id: 1, x: 2, y: 4, z: 6, country: 'UK', lat:54.97, lon:-1.60} + , {id: 2, x: 3, y: 6, z: 9, country: 'US', lat:40.00, lon:-75.5} + , {id: 3, x: 4, y: 8, z: 12, country: 'UK', lat:57.27, lon:-6.20} + , {id: 4, x: 5, y: 10, z: 15, country: 'UK', lat:51.58, lon:0} + , {id: 5, x: 6, y: 12, z: 18, country: 'DE', lat:51.04, lon:7.9} + ]; + var dataset = recline.Backend.createDataset(documents, fields); + return dataset; + } +}; + diff --git a/test/index.html b/test/index.html index e1eddbe3..8131c65c 100644 --- a/test/index.html +++ b/test/index.html @@ -16,6 +16,8 @@ + + @@ -31,6 +33,7 @@ + @@ -42,6 +45,8 @@
+ +
diff --git a/test/view.test.js b/test/view.test.js new file mode 100644 index 00000000..c28e3bd3 --- /dev/null +++ b/test/view.test.js @@ -0,0 +1,31 @@ +(function ($) { + +module("View - Explorer"); + +test('basic explorer functionality', function () { + var $el = $('
'); + $('.fixtures .data-explorer-here').append($el); + var dataset = Fixture.getDataset(); + var explorer = new recline.View.DataExplorer({ + model: dataset, + el: $el + }); + var $explorer = $el.find('.recline-data-explorer'); + equal($explorer.length, 1); + $el.remove(); +}); + +test('getState', function () { + var $el = $('
'); + $('.fixtures .data-explorer-here').append($el); + var dataset = Fixture.getDataset(); + var explorer = new recline.View.DataExplorer({ + model: dataset, + el: $el + }); + // explorer.getState(); + $el.remove(); +}); + +})(this.jQuery); +