X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fvisibility.js;h=1cc3764b29bbd7249fdcea1206cb7b5db5ef8330;hb=d97bf726ccc5645e60171f86b134fb29ac31b846;hp=77f2ea6ec06f22f9cbe8c1ddd36500e047a40e26;hpb=1f0f434a67305ccb3d54a0bbd16a1b6d9421fffb;p=dygraphs.git diff --git a/auto_tests/tests/visibility.js b/auto_tests/tests/visibility.js index 77f2ea6..1cc3764 100644 --- a/auto_tests/tests/visibility.js +++ b/auto_tests/tests/visibility.js @@ -3,14 +3,12 @@ * @author sergeyslepian@gmail.com */ -var VisibilityTestCase = TestCase("visibility"); +import Dygraph from '../../src/dygraph'; +import Util from './Util'; -VisibilityTestCase.prototype.setUp = function() { - document.body.innerHTML = "
"; -}; +describe("visibility", function() { -VisibilityTestCase.prototype.tearDown = function() { -}; +cleanupAfterEach(); /** * Does a bunch of the shared busywork of setting up a graph and changing its visibility. @@ -18,7 +16,7 @@ VisibilityTestCase.prototype.tearDown = function() { * @param {*[]} setVisibilityArgs An array of arguments to be passed directly to setVisibility() * @returns {string} The output of Util.getLegend() called after the visibility is set */ -VisibilityTestCase.prototype.getVisibleSeries = function(startingVisibility, setVisibilityArgs) { +var getVisibleSeries = function(startingVisibility, setVisibilityArgs) { var opts = { width: 480, height: 320, @@ -46,23 +44,33 @@ VisibilityTestCase.prototype.getVisibleSeries = function(startingVisibility, set return Util.getLegend(); }; -VisibilityTestCase.prototype.testDefaultCases = function() { - assertEquals(' A B C D E', this.getVisibleSeries(true, [[], true])); - assertEquals('', this.getVisibleSeries(false, [[], true])); -}; +it('testDefaultCases', function() { + assert.equal(' A B C D E', getVisibleSeries(true, [[], true])); + assert.equal('', getVisibleSeries(false, [[], true])); +}); -VisibilityTestCase.prototype.testSingleSeriesHide = function() { - assertEquals(' A C D E', this.getVisibleSeries(true, [1, false])); -}; +it('testSingleSeriesHide', function() { + assert.equal(' A C D E', getVisibleSeries(true, [1, false])); +}); -VisibilityTestCase.prototype.testSingleSeriesShow = function() { - assertEquals(' E', this.getVisibleSeries(false, [4, true])); -}; +it('testSingleSeriesShow', function() { + assert.equal(' E', getVisibleSeries(false, [4, true])); +}); -VisibilityTestCase.prototype.testMultiSeriesHide = function() { - assertEquals(' A E', this.getVisibleSeries(true, [[1,2,3], false])); -}; +it('testMultiSeriesHide', function() { + assert.equal(' A E', getVisibleSeries(true, [[1,2,3], false])); +}); + +it('testMultiSeriesShow', function() { + assert.equal(' B D', getVisibleSeries(false, [[1,3], true])); +}); + +it('testObjectSeriesShowAndHide', function() { + assert.equal(' B D', getVisibleSeries(false, [{1:true, 2:false, 3:true}, null])); +}); + +it('testBooleanArraySeriesShowAndHide', function() { + assert.equal(' B D', getVisibleSeries(false, [[false, true, false, true], null])); +}); -VisibilityTestCase.prototype.testMultiSeriesShow = function() { - assertEquals(' B D', this.getVisibleSeries(false, [[1,3], true])); -}; \ No newline at end of file +});