[#45,test/view][s]: start on some basic tests for data explorer view.
This commit is contained in:
parent
b0bf06c52e
commit
05293cbb6f
16
test/base.js
Normal file
16
test/base.js
Normal file
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
<script src="sinon/1.1.1/sinon.js"></script>
|
||||
<script src="sinon-qunit/1.0.0/sinon-qunit.js"></script>
|
||||
|
||||
<script type="text/javascript" src="base.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../src/model.js"></script>
|
||||
<script type="text/javascript" src="model.test.js"></script>
|
||||
<script type="text/javascript" src="../src/backend/base.js"></script>
|
||||
@ -31,6 +33,7 @@
|
||||
<script type="text/javascript" src="../src/view-grid.js"></script>
|
||||
<script type="text/javascript" src="../src/view-transform-dialog.js"></script>
|
||||
<script type="text/javascript" src="view-grid.test.js"></script>
|
||||
<script type="text/javascript" src="view.test.js"></script>
|
||||
<script type="text/javascript" src="util.test.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
@ -42,6 +45,8 @@
|
||||
<div class="fixtures">
|
||||
<table class="test-datatable">
|
||||
</table>
|
||||
|
||||
<div class="data-explorer-here"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
31
test/view.test.js
Normal file
31
test/view.test.js
Normal file
@ -0,0 +1,31 @@
|
||||
(function ($) {
|
||||
|
||||
module("View - Explorer");
|
||||
|
||||
test('basic explorer functionality', function () {
|
||||
var $el = $('<div class="test-view-explorer-basic" />');
|
||||
$('.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 = $('<div class="test-view-explorer-getstate" />');
|
||||
$('.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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user