From b77dc002053084c1a5f5e1860f8bd7dd79e6a94b Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Sun, 22 Feb 2026 03:30:01 +0530 Subject: [PATCH 01/12] test: add tests for Axis constructor and properties --- .../plot/vega/axis/ctor/test/test.aria.js | 181 ++++++++ .../vega/axis/ctor/test/test.band_position.js | 182 ++++++++ .../vega/axis/ctor/test/test.description.js | 176 ++++++++ .../plot/vega/axis/ctor/test/test.domain.js | 174 ++++++++ .../vega/axis/ctor/test/test.domain_cap.js | 190 ++++++++ .../vega/axis/ctor/test/test.domain_color.js | 183 ++++++++ .../vega/axis/ctor/test/test.domain_dash.js | 176 ++++++++ .../axis/ctor/test/test.domain_dash_offset.js | 181 ++++++++ .../axis/ctor/test/test.domain_opacity.js | 175 ++++++++ .../vega/axis/ctor/test/test.domain_width.js | 185 ++++++++ .../plot/vega/axis/ctor/test/test.format.js | 172 ++++++++ .../vega/axis/ctor/test/test.format_type.js | 179 ++++++++ .../plot/vega/axis/ctor/test/test.grid.js | 174 ++++++++ .../plot/vega/axis/ctor/test/test.grid_cap.js | 190 ++++++++ .../vega/axis/ctor/test/test.grid_color.js | 183 ++++++++ .../vega/axis/ctor/test/test.grid_dash.js | 176 ++++++++ .../axis/ctor/test/test.grid_dash_offset.js | 181 ++++++++ .../vega/axis/ctor/test/test.grid_opacity.js | 175 ++++++++ .../vega/axis/ctor/test/test.grid_scale.js | 183 ++++++++ .../vega/axis/ctor/test/test.grid_width.js | 185 ++++++++ .../@stdlib/plot/vega/axis/ctor/test/test.js | 415 ++++++++++++++++++ .../vega/axis/ctor/test/test.label_align.js | 183 ++++++++ .../vega/axis/ctor/test/test.label_angle.js | 181 ++++++++ .../axis/ctor/test/test.label_baseline.js | 181 ++++++++ .../vega/axis/ctor/test/test.label_bound.js | 178 ++++++++ .../vega/axis/ctor/test/test.label_color.js | 183 ++++++++ .../vega/axis/ctor/test/test.label_flush.js | 178 ++++++++ .../axis/ctor/test/test.label_flush_offset.js | 174 ++++++++ .../vega/axis/ctor/test/test.label_font.js | 183 ++++++++ .../axis/ctor/test/test.label_font_size.js | 181 ++++++++ .../axis/ctor/test/test.label_font_style.js | 183 ++++++++ .../axis/ctor/test/test.label_font_weight.js | 180 ++++++++ .../vega/axis/ctor/test/test.label_limit.js | 176 ++++++++ .../axis/ctor/test/test.label_line_height.js | 181 ++++++++ .../vega/axis/ctor/test/test.label_offset.js | 181 ++++++++ .../vega/axis/ctor/test/test.label_opacity.js | 175 ++++++++ .../vega/axis/ctor/test/test.label_overlap.js | 185 ++++++++ .../vega/axis/ctor/test/test.label_padding.js | 181 ++++++++ .../axis/ctor/test/test.label_separation.js | 178 ++++++++ .../plot/vega/axis/ctor/test/test.labels.js | 174 ++++++++ .../vega/axis/ctor/test/test.max_extent.js | 185 ++++++++ .../vega/axis/ctor/test/test.min_extent.js | 185 ++++++++ .../plot/vega/axis/ctor/test/test.offset.js | 181 ++++++++ .../plot/vega/axis/ctor/test/test.orient.js | 198 +++++++++ .../plot/vega/axis/ctor/test/test.position.js | 174 ++++++++ .../vega/axis/ctor/test/test.properties.js | 86 ++++ .../plot/vega/axis/ctor/test/test.scale.js | 174 ++++++++ .../vega/axis/ctor/test/test.tick_band.js | 185 ++++++++ .../plot/vega/axis/ctor/test/test.tick_cap.js | 190 ++++++++ .../vega/axis/ctor/test/test.tick_color.js | 183 ++++++++ .../vega/axis/ctor/test/test.tick_count.js | 175 ++++++++ .../vega/axis/ctor/test/test.tick_dash.js | 176 ++++++++ .../axis/ctor/test/test.tick_dash_offset.js | 181 ++++++++ .../vega/axis/ctor/test/test.tick_extra.js | 179 ++++++++ .../vega/axis/ctor/test/test.tick_min_step.js | 181 ++++++++ .../vega/axis/ctor/test/test.tick_offset.js | 181 ++++++++ .../vega/axis/ctor/test/test.tick_opacity.js | 175 ++++++++ .../vega/axis/ctor/test/test.tick_round.js | 179 ++++++++ .../vega/axis/ctor/test/test.tick_size.js | 185 ++++++++ .../vega/axis/ctor/test/test.tick_width.js | 185 ++++++++ .../plot/vega/axis/ctor/test/test.ticks.js | 174 ++++++++ .../plot/vega/axis/ctor/test/test.title.js | 183 ++++++++ .../vega/axis/ctor/test/test.title_align.js | 179 ++++++++ .../vega/axis/ctor/test/test.title_anchor.js | 178 ++++++++ .../vega/axis/ctor/test/test.title_angle.js | 181 ++++++++ .../axis/ctor/test/test.title_baseline.js | 181 ++++++++ .../vega/axis/ctor/test/test.title_color.js | 183 ++++++++ .../vega/axis/ctor/test/test.title_font.js | 183 ++++++++ .../axis/ctor/test/test.title_font_size.js | 181 ++++++++ .../axis/ctor/test/test.title_font_style.js | 183 ++++++++ .../axis/ctor/test/test.title_font_weight.js | 180 ++++++++ .../vega/axis/ctor/test/test.title_limit.js | 176 ++++++++ .../axis/ctor/test/test.title_line_height.js | 181 ++++++++ .../vega/axis/ctor/test/test.title_opacity.js | 175 ++++++++ .../vega/axis/ctor/test/test.title_padding.js | 181 ++++++++ .../plot/vega/axis/ctor/test/test.title_x.js | 181 ++++++++ .../plot/vega/axis/ctor/test/test.title_y.js | 181 ++++++++ .../vega/axis/ctor/test/test.translate.js | 174 ++++++++ .../plot/vega/axis/ctor/test/test.zindex.js | 174 ++++++++ 79 files changed, 14379 insertions(+) create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_opacity.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js create mode 100644 lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js new file mode 100644 index 000000000000..688abf2e5a4b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `aria` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'aria' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'aria' ), true, 'returns expected value' ); + t.strictEqual( isBoolean( v.aria ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `aria` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'aria': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `aria` property which throws an error if set to a non-boolean value', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.aria = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `aria` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.aria, true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'aria': false + }); + t.strictEqual( axis.aria, false, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'aria': true + }); + t.strictEqual( axis.aria, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `aria` property which can be set to a boolean', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.aria = true; + t.strictEqual( axis.aria, true, 'returns expected value' ); + + axis.aria = false; + t.strictEqual( axis.aria, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `aria` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.aria = false; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.aria = true; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.aria = true; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js new file mode 100644 index 000000000000..25c26578a2ac --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js @@ -0,0 +1,182 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `bandPosition` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'bandPosition' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'bandPosition' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.bandPosition ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'bandPosition': 0.5 + }); + t.strictEqual( isNumber( v.bandPosition ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `bandPosition` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -0.1, + 1.1, + NaN, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'bandPosition': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `bandPosition` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -0.1, + 1.1, + NaN, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.bandPosition = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `bandPosition` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.bandPosition ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'bandPosition': 0.5 + }); + t.strictEqual( axis.bandPosition, 0.5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `bandPosition` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.bandPosition = 0.5; + t.strictEqual( axis.bandPosition, 0.5, 'returns expected value' ); + + axis.bandPosition = 0; + t.strictEqual( axis.bandPosition, 0, 'returns expected value' ); + + axis.bandPosition = 1; + t.strictEqual( axis.bandPosition, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `bandPosition` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.bandPosition = 0.5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.bandPosition = 0.3; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.bandPosition = 0.3; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js new file mode 100644 index 000000000000..71a0977e15e2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js @@ -0,0 +1,176 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `description` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'description' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'description' ), true, 'returns expected value' ); + t.strictEqual( isString( v.description ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `description` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'description': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `description` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.description = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `description` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.description, '', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'description': 'An axis' + }); + t.strictEqual( axis.description, 'An axis', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `description` property which can be set to a string', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.description = 'An axis'; + t.strictEqual( axis.description, 'An axis', 'returns expected value' ); + + axis.description = 'Another axis'; + t.strictEqual( axis.description, 'Another axis', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `description` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.description = 'An axis'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.description = 'Another axis'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.description = 'Another axis'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js new file mode 100644 index 000000000000..43c0812d657a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js @@ -0,0 +1,174 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `domain` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'domain' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'domain' ), true, 'returns expected value' ); + t.strictEqual( isBoolean( v.domain ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `domain` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domain': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `domain` property which throws an error if set to a non-boolean value', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.domain = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `domain` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.domain, true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'domain': false + }); + t.strictEqual( axis.domain, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `domain` property which can be set to a boolean', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.domain = false; + t.strictEqual( axis.domain, false, 'returns expected value' ); + + axis.domain = true; + t.strictEqual( axis.domain, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `domain` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.domain = false; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.domain = true; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.domain = true; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js new file mode 100644 index 000000000000..880f0eb24f01 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js @@ -0,0 +1,190 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `domainCap` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'domainCap' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'domainCap' ), true, 'returns expected value' ); + t.strictEqual( isString( v.domainCap ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `domainCap` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainCap': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `domainCap` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.domainCap = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `domainCap` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.domainCap, 'butt', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'domainCap': 'round' + }); + t.strictEqual( axis.domainCap, 'round', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'domainCap': 'square' + }); + t.strictEqual( axis.domainCap, 'square', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `domainCap` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.domainCap = 'round'; + t.strictEqual( axis.domainCap, 'round', 'returns expected value' ); + + axis.domainCap = 'square'; + t.strictEqual( axis.domainCap, 'square', 'returns expected value' ); + + axis.domainCap = 'butt'; + t.strictEqual( axis.domainCap, 'butt', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `domainCap` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.domainCap = 'round'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.domainCap = 'square'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.domainCap = 'square'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js new file mode 100644 index 000000000000..d2f8f3ceaf7f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `domainColor` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'domainColor' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'domainColor' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.domainColor ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'domainColor': 'steelblue' + }); + t.strictEqual( isString( v.domainColor ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `domainColor` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainColor': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `domainColor` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.domainColor = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `domainColor` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.domainColor ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'domainColor': 'steelblue' + }); + t.strictEqual( axis.domainColor, 'steelblue', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `domainColor` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.domainColor = 'steelblue'; + t.strictEqual( axis.domainColor, 'steelblue', 'returns expected value' ); + + axis.domainColor = 'red'; + t.strictEqual( axis.domainColor, 'red', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `domainColor` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.domainColor = 'steelblue'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.domainColor = 'red'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.domainColor = 'red'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js new file mode 100644 index 000000000000..4b55762db3a9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js @@ -0,0 +1,176 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isArray = require( '@stdlib/assert/is-array' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `domainDash` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'domainDash' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'domainDash' ), true, 'returns expected value' ); + t.strictEqual( isArray( v.domainDash ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `domainDash` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + true, + false, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainDash': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `domainDash` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + true, + false, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.domainDash = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `domainDash` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.deepEqual( axis.domainDash, [], 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'domainDash': [ 2, 4 ] + }); + t.deepEqual( axis.domainDash, [ 2, 4 ], 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `domainDash` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.domainDash = [ 2, 4 ]; + t.deepEqual( axis.domainDash, [ 2, 4 ], 'returns expected value' ); + + axis.domainDash = []; + t.deepEqual( axis.domainDash, [], 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `domainDash` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.domainDash = [ 2, 4 ]; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.domainDash = [ 1, 2 ]; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.domainDash = [ 1, 2 ]; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js new file mode 100644 index 000000000000..864895387d30 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `domainDashOffset` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'domainDashOffset' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'domainDashOffset' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.domainDashOffset ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'domainDashOffset': 1 + }); + t.strictEqual( isNumber( v.domainDashOffset ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `domainDashOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainDashOffset': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `domainDashOffset` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.domainDashOffset = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `domainDashOffset` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.domainDashOffset ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'domainDashOffset': 1 + }); + t.strictEqual( axis.domainDashOffset, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `domainDashOffset` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.domainDashOffset = 1; + t.strictEqual( axis.domainDashOffset, 1, 'returns expected value' ); + + axis.domainDashOffset = 2; + t.strictEqual( axis.domainDashOffset, 2, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `domainDashOffset` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.domainDashOffset = 1; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.domainDashOffset = 2; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.domainDashOffset = 2; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js new file mode 100644 index 000000000000..4698682ab495 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js @@ -0,0 +1,175 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `domainOpacity` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'domainOpacity' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'domainOpacity' ), true, 'returns expected value' ); + t.strictEqual( isNumber( v.domainOpacity ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `domainOpacity` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + 2, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainOpacity': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `domainOpacity` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + 2, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.domainOpacity = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `domainOpacity` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.domainOpacity, 1, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'domainOpacity': 0.5 + }); + t.strictEqual( axis.domainOpacity, 0.5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `domainOpacity` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.domainOpacity = 0.5; + t.strictEqual( axis.domainOpacity, 0.5, 'returns expected value' ); + + axis.domainOpacity = 0; + t.strictEqual( axis.domainOpacity, 0, 'returns expected value' ); + + axis.domainOpacity = 1; + t.strictEqual( axis.domainOpacity, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `domainOpacity` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.domainOpacity = 0.5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.domainOpacity = 0; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.domainOpacity = 0; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js new file mode 100644 index 000000000000..7e8cda71604d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js @@ -0,0 +1,185 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `domainWidth` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'domainWidth' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'domainWidth' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.domainWidth ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'domainWidth': 2 + }); + t.strictEqual( isNumber( v.domainWidth ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `domainWidth` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainWidth': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `domainWidth` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.domainWidth = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `domainWidth` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.domainWidth ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'domainWidth': 2 + }); + t.strictEqual( axis.domainWidth, 2, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `domainWidth` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.domainWidth = 2; + t.strictEqual( axis.domainWidth, 2, 'returns expected value' ); + + axis.domainWidth = 0; + t.strictEqual( axis.domainWidth, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `domainWidth` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.domainWidth = 2; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.domainWidth = 3; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.domainWidth = 3; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js new file mode 100644 index 000000000000..6aa9ba15ded6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js @@ -0,0 +1,172 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `format` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'format' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'format' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.format ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `format` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'format': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `format` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.format = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `format` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.format ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'format': '.2f' + }); + t.strictEqual( axis.format, '.2f', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `format` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.format = '.2f'; + t.strictEqual( axis.format, '.2f', 'returns expected value' ); + + axis.format = '.0%'; + t.strictEqual( axis.format, '.0%', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `format` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.format = '.2f'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.format = '.0%'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.format = '.0%'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js new file mode 100644 index 000000000000..597033bea804 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js @@ -0,0 +1,179 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `formatType` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'formatType' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'formatType' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.formatType ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `formatType` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'formatType': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `formatType` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.formatType = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `formatType` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.formatType ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'formatType': 'number' + }); + t.strictEqual( axis.formatType, 'number', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `formatType` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.formatType = 'number'; + t.strictEqual( axis.formatType, 'number', 'returns expected value' ); + + axis.formatType = 'time'; + t.strictEqual( axis.formatType, 'time', 'returns expected value' ); + + axis.formatType = 'utc'; + t.strictEqual( axis.formatType, 'utc', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `formatType` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.formatType = 'number'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.formatType = 'time'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.formatType = 'time'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js new file mode 100644 index 000000000000..dea2ca0ad1b0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js @@ -0,0 +1,174 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `grid` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'grid' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'grid' ), true, 'returns expected value' ); + t.strictEqual( isBoolean( v.grid ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `grid` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'grid': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `grid` property which throws an error if set to a non-boolean value', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.grid = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `grid` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.grid, false, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'grid': true + }); + t.strictEqual( axis.grid, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `grid` property which can be set to a boolean', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.grid = true; + t.strictEqual( axis.grid, true, 'returns expected value' ); + + axis.grid = false; + t.strictEqual( axis.grid, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `grid` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.grid = true; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.grid = false; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.grid = false; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js new file mode 100644 index 000000000000..27a088212c01 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js @@ -0,0 +1,190 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `gridCap` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'gridCap' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'gridCap' ), true, 'returns expected value' ); + t.strictEqual( isString( v.gridCap ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `gridCap` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridCap': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `gridCap` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.gridCap = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `gridCap` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.gridCap, 'butt', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridCap': 'round' + }); + t.strictEqual( axis.gridCap, 'round', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridCap': 'square' + }); + t.strictEqual( axis.gridCap, 'square', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `gridCap` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.gridCap = 'round'; + t.strictEqual( axis.gridCap, 'round', 'returns expected value' ); + + axis.gridCap = 'square'; + t.strictEqual( axis.gridCap, 'square', 'returns expected value' ); + + axis.gridCap = 'butt'; + t.strictEqual( axis.gridCap, 'butt', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `gridCap` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.gridCap = 'round'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.gridCap = 'square'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.gridCap = 'square'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js new file mode 100644 index 000000000000..20bc2e654f92 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `gridColor` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'gridColor' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'gridColor' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.gridColor ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridColor': 'steelblue' + }); + t.strictEqual( isString( v.gridColor ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `gridColor` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridColor': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `gridColor` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.gridColor = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `gridColor` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.gridColor ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridColor': 'steelblue' + }); + t.strictEqual( axis.gridColor, 'steelblue', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `gridColor` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.gridColor = 'steelblue'; + t.strictEqual( axis.gridColor, 'steelblue', 'returns expected value' ); + + axis.gridColor = 'red'; + t.strictEqual( axis.gridColor, 'red', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `gridColor` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.gridColor = 'steelblue'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.gridColor = 'red'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.gridColor = 'red'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js new file mode 100644 index 000000000000..e02b47153868 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js @@ -0,0 +1,176 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isArray = require( '@stdlib/assert/is-array' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `gridDash` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'gridDash' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'gridDash' ), true, 'returns expected value' ); + t.strictEqual( isArray( v.gridDash ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `gridDash` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + true, + false, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridDash': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `gridDash` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + true, + false, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.gridDash = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `gridDash` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.deepEqual( axis.gridDash, [], 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridDash': [ 2, 4 ] + }); + t.deepEqual( axis.gridDash, [ 2, 4 ], 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `gridDash` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.gridDash = [ 2, 4 ]; + t.deepEqual( axis.gridDash, [ 2, 4 ], 'returns expected value' ); + + axis.gridDash = []; + t.deepEqual( axis.gridDash, [], 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `gridDash` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.gridDash = [ 2, 4 ]; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.gridDash = [ 1, 2 ]; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.gridDash = [ 1, 2 ]; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js new file mode 100644 index 000000000000..2341e6d453a8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `gridDashOffset` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'gridDashOffset' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'gridDashOffset' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.gridDashOffset ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridDashOffset': 1 + }); + t.strictEqual( isNumber( v.gridDashOffset ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `gridDashOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridDashOffset': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `gridDashOffset` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.gridDashOffset = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `gridDashOffset` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.gridDashOffset ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridDashOffset': 1 + }); + t.strictEqual( axis.gridDashOffset, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `gridDashOffset` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.gridDashOffset = 1; + t.strictEqual( axis.gridDashOffset, 1, 'returns expected value' ); + + axis.gridDashOffset = 2; + t.strictEqual( axis.gridDashOffset, 2, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `gridDashOffset` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.gridDashOffset = 1; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.gridDashOffset = 2; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.gridDashOffset = 2; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js new file mode 100644 index 000000000000..813a5ceeaf91 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js @@ -0,0 +1,175 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `gridOpacity` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'gridOpacity' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'gridOpacity' ), true, 'returns expected value' ); + t.strictEqual( isNumber( v.gridOpacity ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `gridOpacity` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + 2, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridOpacity': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `gridOpacity` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + 2, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.gridOpacity = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `gridOpacity` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.gridOpacity, 1, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridOpacity': 0.5 + }); + t.strictEqual( axis.gridOpacity, 0.5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `gridOpacity` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.gridOpacity = 0.5; + t.strictEqual( axis.gridOpacity, 0.5, 'returns expected value' ); + + axis.gridOpacity = 0; + t.strictEqual( axis.gridOpacity, 0, 'returns expected value' ); + + axis.gridOpacity = 1; + t.strictEqual( axis.gridOpacity, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `gridOpacity` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.gridOpacity = 0.5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.gridOpacity = 0; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.gridOpacity = 0; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js new file mode 100644 index 000000000000..f2cf775e796e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `gridScale` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'gridScale' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'gridScale' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.gridScale ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridScale': 'yScale' + }); + t.strictEqual( isString( v.gridScale ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `gridScale` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridScale': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `gridScale` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.gridScale = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `gridScale` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.gridScale ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridScale': 'yScale' + }); + t.strictEqual( axis.gridScale, 'yScale', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `gridScale` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.gridScale = 'yScale'; + t.strictEqual( axis.gridScale, 'yScale', 'returns expected value' ); + + axis.gridScale = 'zScale'; + t.strictEqual( axis.gridScale, 'zScale', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `gridScale` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.gridScale = 'yScale'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.gridScale = 'zScale'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.gridScale = 'zScale'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js new file mode 100644 index 000000000000..e9d18bb910dd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js @@ -0,0 +1,185 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `gridWidth` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'gridWidth' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'gridWidth' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.gridWidth ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridWidth': 2 + }); + t.strictEqual( isNumber( v.gridWidth ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `gridWidth` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridWidth': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `gridWidth` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.gridWidth = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `gridWidth` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.gridWidth ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'gridWidth': 2 + }); + t.strictEqual( axis.gridWidth, 2, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `gridWidth` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.gridWidth = 2; + t.strictEqual( axis.gridWidth, 2, 'returns expected value' ); + + axis.gridWidth = 0; + t.strictEqual( axis.gridWidth, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `gridWidth` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.gridWidth = 2; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.gridWidth = 3; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.gridWidth = 3; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.js new file mode 100644 index 000000000000..ed29584d2f49 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.js @@ -0,0 +1,415 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var instanceOf = require( '@stdlib/assert/instance-of' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function is a constructor', function test( t ) { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( instanceOf( axis, Axis ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor does not require the `new` keyword', function test( t ) { + var axis; + var ctor; + + ctor = Axis; + axis = ctor({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( instanceOf( axis, Axis ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor does not require the `new` keyword (options)', function test( t ) { + var axis; + var ctor; + + ctor = Axis; + axis = ctor({ + 'scale': 'xScale', + 'orient': 'bottom', + 'grid': true + }); + t.strictEqual( instanceOf( axis, Axis ), true, 'returns expected value' ); + t.strictEqual( axis.grid, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an options argument which is not an object', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + true, + false, + [], + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis( value ); // eslint-disable-line no-unused-vars + }; + } +}); + +tape( 'the constructor throws an error if not provided a `scale` option', function test( t ) { + t.throws( foo, TypeError, 'throws an error' ); + t.end(); + + function foo() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'orient': 'bottom' + }); + } +}); + +tape( 'the constructor throws an error if not provided an `orient` option', function test( t ) { + t.throws( foo, TypeError, 'throws an error' ); + t.end(); + + function foo() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale' + }); + } +}); + +tape( 'the constructor has a read-only `name` property', function test( t ) { + t.strictEqual( Axis.name, 'Axis', 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor returns an instance having a `toJSON` method for serializing an instance to JSON', function test( t ) { + var expected; + var axis; + var json; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + json = axis.toJSON(); + + expected = { + 'aria': true, + 'description': '', + 'domain': true, + 'domainCap': 'butt', + 'domainDash': [], + 'domainOpacity': 1, + 'grid': false, + 'gridCap': 'butt', + 'gridDash': [], + 'gridOpacity': 1, + 'labelBound': false, + 'labelFlushOffset': 0, + 'labelOpacity': 1, + 'labelOverlap': false, + 'labels': true, + 'labelSeparation': 0, + 'orient': 'bottom', + 'position': 0, + 'scale': 'xScale', + 'tickCap': 'butt', + 'tickDash': [], + 'tickOpacity': 1, + 'ticks': true, + 'title': [ '' ], + 'titleAnchor': null, + 'titleOpacity': 1, + 'translate': 0.5, + 'zindex': 0 + }; + t.deepEqual( json, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor returns an instance having a `toJSON` method for serializing an instance to JSON (options)', function test( t ) { + var expected; + var axis; + var json; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'aria': false, + 'bandPosition': 0.5, + 'description': 'An axis', + 'domain': false, + 'domainCap': 'round', + 'domainColor': 'steelblue', + 'domainDash': [ 2, 4 ], + 'domainDashOffset': 1, + 'domainOpacity': 0.5, + 'domainWidth': 2, + 'format': '.1f', + 'formatType': 'number', + 'grid': true, + 'gridCap': 'round', + 'gridColor': 'gray', + 'gridDash': [ 1, 2 ], + 'gridDashOffset': 1, + 'gridOpacity': 0.5, + 'gridScale': 'yScale', + 'gridWidth': 1, + 'labelAlign': 'center', + 'labelAngle': 45, + 'labelBaseline': 'top', + 'labelBound': true, + 'labelColor': 'red', + 'labelFlush': true, + 'labelFlushOffset': 5, + 'labelFont': 'Arial', + 'labelFontSize': 12, + 'labelFontStyle': 'italic', + 'labelFontWeight': 'bold', + 'labelLimit': 200, + 'labelLineHeight': 16, + 'labelOffset': 4, + 'labelOpacity': 0.8, + 'labelOverlap': 'parity', + 'labelPadding': 4, + 'labels': false, + 'labelSeparation': 2, + 'maxExtent': 100, + 'minExtent': 50, + 'offset': 10, + 'position': 5, + 'tickBand': 'center', + 'tickCap': 'round', + 'tickColor': 'black', + 'tickCount': 10, + 'tickDash': [ 2, 2 ], + 'tickDashOffset': 1, + 'tickExtra': true, + 'tickMinStep': 1, + 'tickOffset': 2, + 'tickOpacity': 0.9, + 'tickRound': true, + 'ticks': false, + 'tickSize': 5, + 'tickWidth': 1, + 'title': 'X Axis', + 'titleAlign': 'center', + 'titleAnchor': 'start', + 'titleAngle': 0, + 'titleBaseline': 'bottom', + 'titleColor': 'black', + 'titleFont': 'Helvetica', + 'titleFontSize': 14, + 'titleFontStyle': 'normal', + 'titleFontWeight': 'bold', + 'titleLimit': 300, + 'titleLineHeight': 18, + 'titleOpacity': 0.9, + 'titlePadding': 8, + 'titleX': 10, + 'titleY': 20, + 'translate': 1, + 'zindex': 2 + }); + json = axis.toJSON(); + + expected = { + 'aria': false, + 'bandPosition': 0.5, + 'description': 'An axis', + 'domain': false, + 'domainCap': 'round', + 'domainColor': 'steelblue', + 'domainDash': [ 2, 4 ], + 'domainDashOffset': 1, + 'domainOpacity': 0.5, + 'domainWidth': 2, + 'format': '.1f', + 'formatType': 'number', + 'grid': true, + 'gridCap': 'round', + 'gridColor': 'gray', + 'gridDash': [ 1, 2 ], + 'gridDashOffset': 1, + 'gridOpacity': 0.5, + 'gridScale': 'yScale', + 'gridWidth': 1, + 'labelAlign': 'center', + 'labelAngle': 45, + 'labelBaseline': 'top', + 'labelBound': true, + 'labelColor': 'red', + 'labelFlush': true, + 'labelFlushOffset': 5, + 'labelFont': 'Arial', + 'labelFontSize': 12, + 'labelFontStyle': 'italic', + 'labelFontWeight': 'bold', + 'labelLimit': 200, + 'labelLineHeight': 16, + 'labelOffset': 4, + 'labelOpacity': 0.8, + 'labelOverlap': 'parity', + 'labelPadding': 4, + 'labels': false, + 'labelSeparation': 2, + 'maxExtent': 100, + 'minExtent': 50, + 'offset': 10, + 'orient': 'bottom', + 'position': 5, + 'scale': 'xScale', + 'tickBand': 'center', + 'tickCap': 'round', + 'tickColor': 'black', + 'tickCount': 10, + 'tickDash': [ 2, 2 ], + 'tickDashOffset': 1, + 'tickExtra': true, + 'tickMinStep': 1, + 'tickOffset': 2, + 'tickOpacity': 0.9, + 'tickRound': true, + 'ticks': false, + 'tickSize': 5, + 'tickWidth': 1, + 'title': [ 'X Axis' ], + 'titleAlign': 'center', + 'titleAnchor': 'start', + 'titleAngle': 0, + 'titleBaseline': 'bottom', + 'titleColor': 'black', + 'titleFont': 'Helvetica', + 'titleFontSize': 14, + 'titleFontStyle': 'normal', + 'titleFontWeight': 'bold', + 'titleLimit': 300, + 'titleLineHeight': 18, + 'titleOpacity': 0.9, + 'titlePadding': 8, + 'titleX': 10, + 'titleY': 20, + 'translate': 1, + 'zindex': 2 + }; + t.deepEqual( json, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the `toJSON` method is implicitly invoked by `JSON.stringify`', function test( t ) { + var expected; + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + expected = { + 'aria': true, + 'description': '', + 'domain': true, + 'domainCap': 'butt', + 'domainDash': [], + 'domainOpacity': 1, + 'grid': false, + 'gridCap': 'butt', + 'gridDash': [], + 'gridOpacity': 1, + 'labelBound': false, + 'labelFlushOffset': 0, + 'labelOpacity': 1, + 'labelOverlap': false, + 'labels': true, + 'labelSeparation': 0, + 'orient': 'bottom', + 'position': 0, + 'scale': 'xScale', + 'tickCap': 'butt', + 'tickDash': [], + 'tickOpacity': 1, + 'ticks': true, + 'title': [ '' ], + 'titleAnchor': null, + 'titleOpacity': 1, + 'translate': 0.5, + 'zindex': 0 + }; + t.strictEqual( JSON.stringify( axis ), JSON.stringify( expected ), 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor returns an instance which inherits from EventEmitter', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + t.strictEqual( typeof axis.on, 'function', 'returns expected value' ); + t.strictEqual( typeof axis.emit, 'function', 'returns expected value' ); + t.strictEqual( typeof axis.removeListener, 'function', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor ignores unrecognized options', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'beep': 'boop', + 'foo': 'bar' + }); + + t.strictEqual( axis.scale, 'xScale', 'returns expected value' ); + t.strictEqual( hasOwnProp( axis, 'beep' ), false, 'returns expected value' ); + t.strictEqual( hasOwnProp( axis, 'foo' ), false, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js new file mode 100644 index 000000000000..186d1454d82e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelAlign` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelAlign' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelAlign' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelAlign ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelAlign': 'center' + }); + t.strictEqual( isString( v.labelAlign ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelAlign` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelAlign': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelAlign` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelAlign = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelAlign` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelAlign ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelAlign': 'center' + }); + t.strictEqual( axis.labelAlign, 'center', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelAlign` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelAlign = 'center'; + t.strictEqual( axis.labelAlign, 'center', 'returns expected value' ); + + axis.labelAlign = 'left'; + t.strictEqual( axis.labelAlign, 'left', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelAlign` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelAlign = 'center'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelAlign = 'left'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelAlign = 'left'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js new file mode 100644 index 000000000000..bf8d13bae7ac --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelAngle` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelAngle' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelAngle' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelAngle ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelAngle': 45 + }); + t.strictEqual( isNumber( v.labelAngle ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelAngle` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelAngle': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelAngle` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelAngle = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelAngle` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelAngle ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelAngle': 45 + }); + t.strictEqual( axis.labelAngle, 45, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelAngle` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelAngle = 45; + t.strictEqual( axis.labelAngle, 45, 'returns expected value' ); + + axis.labelAngle = 90; + t.strictEqual( axis.labelAngle, 90, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelAngle` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelAngle = 45; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelAngle = 90; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelAngle = 90; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js new file mode 100644 index 000000000000..5a37a7236a7c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelBaseline` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelBaseline' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelBaseline' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelBaseline ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelBaseline` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelBaseline': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelBaseline` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelBaseline = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelBaseline` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelBaseline ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelBaseline': 'top' + }); + t.strictEqual( axis.labelBaseline, 'top', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelBaseline` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelBaseline = 'top'; + t.strictEqual( axis.labelBaseline, 'top', 'returns expected value' ); + + axis.labelBaseline = 'middle'; + t.strictEqual( axis.labelBaseline, 'middle', 'returns expected value' ); + + axis.labelBaseline = 'bottom'; + t.strictEqual( axis.labelBaseline, 'bottom', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelBaseline` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelBaseline = 'top'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelBaseline = 'middle'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelBaseline = 'middle'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js new file mode 100644 index 000000000000..6025ab2ea044 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js @@ -0,0 +1,178 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelBound` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelBound' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelBound' ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelBound` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelBound': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelBound` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelBound = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelBound` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.labelBound, false, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelBound': true + }); + t.strictEqual( axis.labelBound, true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelBound': 10 + }); + t.strictEqual( axis.labelBound, 10, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelBound` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelBound = true; + t.strictEqual( axis.labelBound, true, 'returns expected value' ); + + axis.labelBound = 10; + t.strictEqual( axis.labelBound, 10, 'returns expected value' ); + + axis.labelBound = false; + t.strictEqual( axis.labelBound, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelBound` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelBound = true; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelBound = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelBound = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js new file mode 100644 index 000000000000..b2e8323bc47a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelColor` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelColor' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelColor' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelColor ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelColor': 'steelblue' + }); + t.strictEqual( isString( v.labelColor ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelColor` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelColor': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelColor` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelColor = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelColor` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelColor ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelColor': 'steelblue' + }); + t.strictEqual( axis.labelColor, 'steelblue', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelColor` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelColor = 'steelblue'; + t.strictEqual( axis.labelColor, 'steelblue', 'returns expected value' ); + + axis.labelColor = 'red'; + t.strictEqual( axis.labelColor, 'red', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelColor` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelColor = 'steelblue'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelColor = 'red'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelColor = 'red'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js new file mode 100644 index 000000000000..cdb8825a57a9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js @@ -0,0 +1,178 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelFlush` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelFlush' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelFlush' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelFlush ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelFlush` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFlush': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFlush` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelFlush = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFlush` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelFlush ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFlush': true + }); + t.strictEqual( axis.labelFlush, true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFlush': 10 + }); + t.strictEqual( axis.labelFlush, 10, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelFlush` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelFlush = true; + t.strictEqual( axis.labelFlush, true, 'returns expected value' ); + + axis.labelFlush = 10; + t.strictEqual( axis.labelFlush, 10, 'returns expected value' ); + + axis.labelFlush = false; + t.strictEqual( axis.labelFlush, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelFlush` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelFlush = true; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelFlush = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelFlush = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js new file mode 100644 index 000000000000..7744a4173a12 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js @@ -0,0 +1,174 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelFlushOffset` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelFlushOffset' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelFlushOffset' ), true, 'returns expected value' ); + t.strictEqual( isNumber( v.labelFlushOffset ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelFlushOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFlushOffset': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFlushOffset` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelFlushOffset = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFlushOffset` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.labelFlushOffset, 0, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFlushOffset': 5 + }); + t.strictEqual( axis.labelFlushOffset, 5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelFlushOffset` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelFlushOffset = 5; + t.strictEqual( axis.labelFlushOffset, 5, 'returns expected value' ); + + axis.labelFlushOffset = 10; + t.strictEqual( axis.labelFlushOffset, 10, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelFlushOffset` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelFlushOffset = 5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelFlushOffset = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelFlushOffset = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js new file mode 100644 index 000000000000..00488fda76cc --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelFont` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelFont' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelFont' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelFont ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFont': 'Arial' + }); + t.strictEqual( isString( v.labelFont ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelFont` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFont': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFont` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelFont = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFont` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelFont ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFont': 'Arial' + }); + t.strictEqual( axis.labelFont, 'Arial', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelFont` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelFont = 'Arial'; + t.strictEqual( axis.labelFont, 'Arial', 'returns expected value' ); + + axis.labelFont = 'Helvetica'; + t.strictEqual( axis.labelFont, 'Helvetica', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelFont` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelFont = 'Arial'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelFont = 'Helvetica'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelFont = 'Helvetica'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js new file mode 100644 index 000000000000..a09d3c60e65a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelFontSize` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelFontSize' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelFontSize' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelFontSize ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontSize': 12 + }); + t.strictEqual( isNumber( v.labelFontSize ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelFontSize` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontSize': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFontSize` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelFontSize = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFontSize` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelFontSize ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontSize': 12 + }); + t.strictEqual( axis.labelFontSize, 12, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelFontSize` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelFontSize = 12; + t.strictEqual( axis.labelFontSize, 12, 'returns expected value' ); + + axis.labelFontSize = 16; + t.strictEqual( axis.labelFontSize, 16, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelFontSize` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelFontSize = 12; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelFontSize = 16; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelFontSize = 16; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js new file mode 100644 index 000000000000..14307bb5abdb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelFontStyle` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelFontStyle' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelFontStyle' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelFontStyle ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontStyle': 'italic' + }); + t.strictEqual( isString( v.labelFontStyle ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelFontStyle` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontStyle': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFontStyle` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelFontStyle = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFontStyle` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelFontStyle ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontStyle': 'italic' + }); + t.strictEqual( axis.labelFontStyle, 'italic', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelFontStyle` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelFontStyle = 'italic'; + t.strictEqual( axis.labelFontStyle, 'italic', 'returns expected value' ); + + axis.labelFontStyle = 'normal'; + t.strictEqual( axis.labelFontStyle, 'normal', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelFontStyle` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelFontStyle = 'italic'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelFontStyle = 'normal'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelFontStyle = 'normal'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js new file mode 100644 index 000000000000..bde53ae90d92 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js @@ -0,0 +1,180 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelFontWeight` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelFontWeight' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelFontWeight' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelFontWeight ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelFontWeight` option', function test( t ) { + var values; + var i; + + values = [ + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontWeight': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFontWeight` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelFontWeight = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelFontWeight` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelFontWeight ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontWeight': 'bold' + }); + t.strictEqual( axis.labelFontWeight, 'bold', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontWeight': 700 + }); + t.strictEqual( axis.labelFontWeight, 700, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelFontWeight` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelFontWeight = 'bold'; + t.strictEqual( axis.labelFontWeight, 'bold', 'returns expected value' ); + + axis.labelFontWeight = 700; + t.strictEqual( axis.labelFontWeight, 700, 'returns expected value' ); + + axis.labelFontWeight = 'normal'; + t.strictEqual( axis.labelFontWeight, 'normal', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelFontWeight` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelFontWeight = 'bold'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelFontWeight = 700; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelFontWeight = 700; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js new file mode 100644 index 000000000000..387922b60064 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js @@ -0,0 +1,176 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelLimit` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelLimit' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelLimit' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelLimit ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelLimit` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelLimit': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelLimit` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelLimit = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelLimit` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelLimit ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelLimit': 100 + }); + t.strictEqual( axis.labelLimit, 100, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelLimit` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelLimit = 100; + t.strictEqual( axis.labelLimit, 100, 'returns expected value' ); + + axis.labelLimit = 200; + t.strictEqual( axis.labelLimit, 200, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelLimit` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelLimit = 100; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelLimit = 200; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelLimit = 200; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js new file mode 100644 index 000000000000..67d487bc4f32 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelLineHeight` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelLineHeight' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelLineHeight' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelLineHeight ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelLineHeight': 20 + }); + t.strictEqual( isNumber( v.labelLineHeight ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelLineHeight` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelLineHeight': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelLineHeight` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelLineHeight = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelLineHeight` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelLineHeight ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelLineHeight': 20 + }); + t.strictEqual( axis.labelLineHeight, 20, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelLineHeight` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelLineHeight = 20; + t.strictEqual( axis.labelLineHeight, 20, 'returns expected value' ); + + axis.labelLineHeight = 24; + t.strictEqual( axis.labelLineHeight, 24, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelLineHeight` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelLineHeight = 20; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelLineHeight = 24; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelLineHeight = 24; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js new file mode 100644 index 000000000000..48f6081c62f3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelOffset` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelOffset' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelOffset' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelOffset ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOffset': 5 + }); + t.strictEqual( isNumber( v.labelOffset ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOffset': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelOffset` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelOffset = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelOffset` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelOffset ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOffset': 5 + }); + t.strictEqual( axis.labelOffset, 5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelOffset` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelOffset = 5; + t.strictEqual( axis.labelOffset, 5, 'returns expected value' ); + + axis.labelOffset = 10; + t.strictEqual( axis.labelOffset, 10, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelOffset` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelOffset = 5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelOffset = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelOffset = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js new file mode 100644 index 000000000000..524db85d26a8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js @@ -0,0 +1,175 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelOpacity` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelOpacity' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelOpacity' ), true, 'returns expected value' ); + t.strictEqual( isNumber( v.labelOpacity ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelOpacity` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -0.1, + 1.1, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOpacity': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelOpacity` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -0.1, + 1.1, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelOpacity = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelOpacity` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.labelOpacity, 1, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOpacity': 0.5 + }); + t.strictEqual( axis.labelOpacity, 0.5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelOpacity` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelOpacity = 0.5; + t.strictEqual( axis.labelOpacity, 0.5, 'returns expected value' ); + + axis.labelOpacity = 0; + t.strictEqual( axis.labelOpacity, 0, 'returns expected value' ); + + axis.labelOpacity = 1; + t.strictEqual( axis.labelOpacity, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelOpacity` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelOpacity = 0.5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelOpacity = 0.3; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelOpacity = 0.3; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js new file mode 100644 index 000000000000..4a2320d27bd0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js @@ -0,0 +1,185 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelOverlap` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelOverlap' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelOverlap' ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelOverlap` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOverlap': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelOverlap` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelOverlap = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelOverlap` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.labelOverlap, false, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOverlap': true + }); + t.strictEqual( axis.labelOverlap, true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOverlap': 'parity' + }); + t.strictEqual( axis.labelOverlap, 'parity', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelOverlap` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelOverlap = true; + t.strictEqual( axis.labelOverlap, true, 'returns expected value' ); + + axis.labelOverlap = 'parity'; + t.strictEqual( axis.labelOverlap, 'parity', 'returns expected value' ); + + axis.labelOverlap = 'greedy'; + t.strictEqual( axis.labelOverlap, 'greedy', 'returns expected value' ); + + axis.labelOverlap = false; + t.strictEqual( axis.labelOverlap, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelOverlap` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelOverlap = true; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelOverlap = 'parity'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelOverlap = 'parity'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js new file mode 100644 index 000000000000..f59b8777ea14 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelPadding` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelPadding' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelPadding' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.labelPadding ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelPadding': 5 + }); + t.strictEqual( isNumber( v.labelPadding ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelPadding` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelPadding': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelPadding` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelPadding = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelPadding` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.labelPadding ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelPadding': 5 + }); + t.strictEqual( axis.labelPadding, 5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelPadding` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelPadding = 5; + t.strictEqual( axis.labelPadding, 5, 'returns expected value' ); + + axis.labelPadding = 10; + t.strictEqual( axis.labelPadding, 10, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelPadding` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelPadding = 5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelPadding = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelPadding = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js new file mode 100644 index 000000000000..17a9cc402e01 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js @@ -0,0 +1,178 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labelSeparation` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labelSeparation' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labelSeparation' ), true, 'returns expected value' ); + t.strictEqual( isNumber( v.labelSeparation ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labelSeparation` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelSeparation': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labelSeparation` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labelSeparation = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labelSeparation` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.labelSeparation, 0, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelSeparation': 10 + }); + t.strictEqual( axis.labelSeparation, 10, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labelSeparation` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labelSeparation = 10; + t.strictEqual( axis.labelSeparation, 10, 'returns expected value' ); + + axis.labelSeparation = 20; + t.strictEqual( axis.labelSeparation, 20, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labelSeparation` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labelSeparation = 10; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labelSeparation = 20; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labelSeparation = 20; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js new file mode 100644 index 000000000000..ccf05550d1b2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js @@ -0,0 +1,174 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `labels` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'labels' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'labels' ), true, 'returns expected value' ); + t.strictEqual( isBoolean( v.labels ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `labels` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labels': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `labels` property which throws an error if set to a non-boolean value', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.labels = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `labels` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.labels, true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labels': false + }); + t.strictEqual( axis.labels, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `labels` property which can be set to a boolean', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.labels = false; + t.strictEqual( axis.labels, false, 'returns expected value' ); + + axis.labels = true; + t.strictEqual( axis.labels, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `labels` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.labels = false; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.labels = true; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.labels = true; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js new file mode 100644 index 000000000000..b27489af8260 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js @@ -0,0 +1,185 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `maxExtent` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'maxExtent' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'maxExtent' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.maxExtent ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'maxExtent': 200 + }); + t.strictEqual( isNumber( v.maxExtent ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `maxExtent` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'maxExtent': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `maxExtent` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.maxExtent = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `maxExtent` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.maxExtent ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'maxExtent': 200 + }); + t.strictEqual( axis.maxExtent, 200, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `maxExtent` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.maxExtent = 200; + t.strictEqual( axis.maxExtent, 200, 'returns expected value' ); + + axis.maxExtent = 300; + t.strictEqual( axis.maxExtent, 300, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `maxExtent` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.maxExtent = 200; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.maxExtent = 300; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.maxExtent = 300; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js new file mode 100644 index 000000000000..b9c33f9ece24 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js @@ -0,0 +1,185 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `minExtent` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'minExtent' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'minExtent' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.minExtent ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'minExtent': 50 + }); + t.strictEqual( isNumber( v.minExtent ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `minExtent` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'minExtent': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `minExtent` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.minExtent = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `minExtent` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.minExtent ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'minExtent': 50 + }); + t.strictEqual( axis.minExtent, 50, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `minExtent` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.minExtent = 50; + t.strictEqual( axis.minExtent, 50, 'returns expected value' ); + + axis.minExtent = 100; + t.strictEqual( axis.minExtent, 100, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `minExtent` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.minExtent = 50; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.minExtent = 100; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.minExtent = 100; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js new file mode 100644 index 000000000000..1fc1189ca118 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has an `offset` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'offset' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'offset' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.offset ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'offset': 10 + }); + t.strictEqual( isNumber( v.offset ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `offset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'offset': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having an `offset` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.offset = value; + }; + } +}); + +tape( 'the constructor returns an instance having an `offset` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.offset ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'offset': 10 + }); + t.strictEqual( axis.offset, 10, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having an `offset` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.offset = 10; + t.strictEqual( axis.offset, 10, 'returns expected value' ); + + axis.offset = 20; + t.strictEqual( axis.offset, 20, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `offset` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.offset = 10; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.offset = 20; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.offset = 20; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js new file mode 100644 index 000000000000..d9fd3826f05c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js @@ -0,0 +1,198 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `orient` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'orient' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'orient' ), true, 'returns expected value' ); + t.strictEqual( isString( v.orient ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `orient` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'BOTTOM', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `orient` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'BOTTOM', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.orient = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `orient` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.orient, 'bottom', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'top' + }); + t.strictEqual( axis.orient, 'top', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'left' + }); + t.strictEqual( axis.orient, 'left', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'right' + }); + t.strictEqual( axis.orient, 'right', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `orient` property which can be set to a valid orientation', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.orient = 'top'; + t.strictEqual( axis.orient, 'top', 'returns expected value' ); + + axis.orient = 'left'; + t.strictEqual( axis.orient, 'left', 'returns expected value' ); + + axis.orient = 'right'; + t.strictEqual( axis.orient, 'right', 'returns expected value' ); + + axis.orient = 'bottom'; + t.strictEqual( axis.orient, 'bottom', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `orient` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.orient = 'top'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.orient = 'left'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.orient = 'left'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js new file mode 100644 index 000000000000..4ad9efbb9b1f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js @@ -0,0 +1,174 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `position` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'position' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'position' ), true, 'returns expected value' ); + t.strictEqual( isNumber( v.position ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `position` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'position': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `position` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.position = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `position` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.position, 0, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'position': 100 + }); + t.strictEqual( axis.position, 100, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `position` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.position = 100; + t.strictEqual( axis.position, 100, 'returns expected value' ); + + axis.position = 200; + t.strictEqual( axis.position, 200, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `position` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.position = 100; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.position = 200; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.position = 200; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.properties.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.properties.js new file mode 100644 index 000000000000..dfbfaa810a89 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.properties.js @@ -0,0 +1,86 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isArray = require( '@stdlib/assert/is-array' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `properties` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'properties' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'properties' ), true, 'returns expected value' ); + t.strictEqual( isArray( v.properties ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor returns an instance having a `properties` property which returns a list of enumerable properties', function test( t ) { + var expected; + var axis; + var props; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + props = axis.properties; + + t.strictEqual( isArray( props ), true, 'returns expected value' ); + + expected = [ 'aria', 'bandPosition', 'description', 'domain', 'domainCap', 'domainColor', 'domainDash', 'domainDashOffset', 'domainOpacity', 'domainWidth', 'encode', 'format', 'formatType', 'grid', 'gridCap', 'gridColor', 'gridDash', 'gridDashOffset', 'gridOpacity', 'gridScale', 'gridWidth', 'labelAlign', 'labelAngle', 'labelBaseline', 'labelBound', 'labelColor', 'labelFlush', 'labelFlushOffset', 'labelFont', 'labelFontSize', 'labelFontStyle', 'labelFontWeight', 'labelLimit', 'labelLineHeight', 'labelOffset', 'labelOpacity', 'labelOverlap', 'labelPadding', 'labels', 'labelSeparation', 'maxExtent', 'minExtent', 'offset', 'orient', 'position', 'scale', 'tickBand', 'tickCap', 'tickColor', 'tickCount', 'tickDash', 'tickDashOffset', 'tickExtra', 'tickMinStep', 'tickOffset', 'tickOpacity', 'tickRound', 'ticks', 'tickSize', 'tickWidth', 'title', 'titleAlign', 'titleAnchor', 'titleAngle', 'titleBaseline', 'titleColor', 'titleFont', 'titleFontSize', 'titleFontStyle', 'titleFontWeight', 'titleLimit', 'titleLineHeight', 'titleOpacity', 'titlePadding', 'titleX', 'titleY', 'translate', 'values', 'zindex' ]; + t.deepEqual( props, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `properties` property which returns a new array on each access', function test( t ) { + var props1; + var props2; + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + props1 = axis.properties; + props2 = axis.properties; + + t.notEqual( props1, props2, 'returns expected value' ); + t.deepEqual( props1, props2, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js new file mode 100644 index 000000000000..fdb876e29f5a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js @@ -0,0 +1,174 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `scale` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'scale' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'scale' ), true, 'returns expected value' ); + t.strictEqual( isString( v.scale ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `scale` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': value, + 'orient': 'bottom' + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `scale` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.scale = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `scale` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.scale, 'xScale', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'yScale', + 'orient': 'left' + }); + t.strictEqual( axis.scale, 'yScale', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `scale` property which can be set to a string', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.scale = 'yScale'; + t.strictEqual( axis.scale, 'yScale', 'returns expected value' ); + + axis.scale = 'xScale'; + t.strictEqual( axis.scale, 'xScale', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `scale` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.scale = 'yScale'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.scale = 'xScale'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.scale = 'xScale'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js new file mode 100644 index 000000000000..ff1841d2221b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js @@ -0,0 +1,185 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickBand` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickBand' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickBand' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.tickBand ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickBand` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickBand': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickBand` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickBand = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickBand` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.tickBand ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickBand': 'center' + }); + t.strictEqual( axis.tickBand, 'center', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickBand': 'extent' + }); + t.strictEqual( axis.tickBand, 'extent', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickBand` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickBand = 'center'; + t.strictEqual( axis.tickBand, 'center', 'returns expected value' ); + + axis.tickBand = 'extent'; + t.strictEqual( axis.tickBand, 'extent', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickBand` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickBand = 'center'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickBand = 'extent'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickBand = 'extent'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js new file mode 100644 index 000000000000..338cdad68576 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js @@ -0,0 +1,190 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickCap` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickCap' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickCap' ), true, 'returns expected value' ); + t.strictEqual( isString( v.tickCap ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickCap` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickCap': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickCap` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickCap = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickCap` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.tickCap, 'butt', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickCap': 'round' + }); + t.strictEqual( axis.tickCap, 'round', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickCap': 'square' + }); + t.strictEqual( axis.tickCap, 'square', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickCap` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickCap = 'round'; + t.strictEqual( axis.tickCap, 'round', 'returns expected value' ); + + axis.tickCap = 'square'; + t.strictEqual( axis.tickCap, 'square', 'returns expected value' ); + + axis.tickCap = 'butt'; + t.strictEqual( axis.tickCap, 'butt', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickCap` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickCap = 'round'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickCap = 'square'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickCap = 'square'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js new file mode 100644 index 000000000000..205429b0ddad --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickColor` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickColor' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickColor' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.tickColor ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickColor': 'steelblue' + }); + t.strictEqual( isString( v.tickColor ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickColor` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickColor': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickColor` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickColor = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickColor` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.tickColor ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickColor': 'steelblue' + }); + t.strictEqual( axis.tickColor, 'steelblue', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickColor` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickColor = 'steelblue'; + t.strictEqual( axis.tickColor, 'steelblue', 'returns expected value' ); + + axis.tickColor = 'red'; + t.strictEqual( axis.tickColor, 'red', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickColor` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickColor = 'steelblue'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickColor = 'red'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickColor = 'red'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js new file mode 100644 index 000000000000..2cb51259732b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js @@ -0,0 +1,175 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickCount` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickCount' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickCount' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.tickCount ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickCount` option', function test( t ) { + var values; + var i; + + values = [ + null, + true, + false, + [], + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickCount': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickCount` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + null, + true, + false, + [], + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickCount = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickCount` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.tickCount ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickCount': 10 + }); + t.strictEqual( axis.tickCount, 10, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickCount': 'day' + }); + t.strictEqual( axis.tickCount, 'day', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickCount` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickCount = 10; + t.strictEqual( axis.tickCount, 10, 'returns expected value' ); + + axis.tickCount = 'day'; + t.strictEqual( axis.tickCount, 'day', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickCount` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickCount = 10; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickCount = 20; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickCount = 20; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js new file mode 100644 index 000000000000..e1abc862e11c --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js @@ -0,0 +1,176 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isArray = require( '@stdlib/assert/is-array' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickDash` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickDash' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickDash' ), true, 'returns expected value' ); + t.strictEqual( isArray( v.tickDash ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickDash` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + true, + false, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickDash': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickDash` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + true, + false, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickDash = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickDash` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.deepEqual( axis.tickDash, [], 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickDash': [ 2, 4 ] + }); + t.deepEqual( axis.tickDash, [ 2, 4 ], 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickDash` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickDash = [ 2, 4 ]; + t.deepEqual( axis.tickDash, [ 2, 4 ], 'returns expected value' ); + + axis.tickDash = []; + t.deepEqual( axis.tickDash, [], 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickDash` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickDash = [ 2, 4 ]; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickDash = [ 1, 2 ]; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickDash = [ 1, 2 ]; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js new file mode 100644 index 000000000000..e649bfe79af7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickDashOffset` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickDashOffset' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickDashOffset' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.tickDashOffset ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickDashOffset': 1 + }); + t.strictEqual( isNumber( v.tickDashOffset ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickDashOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickDashOffset': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickDashOffset` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickDashOffset = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickDashOffset` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.tickDashOffset ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickDashOffset': 1 + }); + t.strictEqual( axis.tickDashOffset, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickDashOffset` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickDashOffset = 1; + t.strictEqual( axis.tickDashOffset, 1, 'returns expected value' ); + + axis.tickDashOffset = 2; + t.strictEqual( axis.tickDashOffset, 2, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickDashOffset` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickDashOffset = 1; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickDashOffset = 2; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickDashOffset = 2; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js new file mode 100644 index 000000000000..dce007e7efb6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js @@ -0,0 +1,179 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickExtra` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickExtra' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickExtra' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.tickExtra ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickExtra` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickExtra': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickExtra` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickExtra = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickExtra` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.tickExtra ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickExtra': true + }); + t.strictEqual( axis.tickExtra, true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickExtra': false + }); + t.strictEqual( axis.tickExtra, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickExtra` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickExtra = true; + t.strictEqual( axis.tickExtra, true, 'returns expected value' ); + + axis.tickExtra = false; + t.strictEqual( axis.tickExtra, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickExtra` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickExtra = true; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickExtra = false; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickExtra = false; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js new file mode 100644 index 000000000000..f3fa1dfea0d5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickMinStep` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickMinStep' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickMinStep' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.tickMinStep ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickMinStep': 1 + }); + t.strictEqual( isNumber( v.tickMinStep ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickMinStep` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickMinStep': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickMinStep` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickMinStep = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickMinStep` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.tickMinStep ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickMinStep': 1 + }); + t.strictEqual( axis.tickMinStep, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickMinStep` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickMinStep = 1; + t.strictEqual( axis.tickMinStep, 1, 'returns expected value' ); + + axis.tickMinStep = 0.5; + t.strictEqual( axis.tickMinStep, 0.5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickMinStep` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickMinStep = 1; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickMinStep = 2; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickMinStep = 2; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js new file mode 100644 index 000000000000..fe5a69ed96a8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickOffset` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickOffset' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickOffset' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.tickOffset ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickOffset': 1 + }); + t.strictEqual( isNumber( v.tickOffset ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickOffset': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickOffset` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickOffset = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickOffset` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.tickOffset ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickOffset': 5 + }); + t.strictEqual( axis.tickOffset, 5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickOffset` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickOffset = 5; + t.strictEqual( axis.tickOffset, 5, 'returns expected value' ); + + axis.tickOffset = 10; + t.strictEqual( axis.tickOffset, 10, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickOffset` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickOffset = 5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickOffset = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickOffset = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_opacity.js new file mode 100644 index 000000000000..d5a6a528512b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_opacity.js @@ -0,0 +1,175 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickOpacity` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickOpacity' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickOpacity' ), true, 'returns expected value' ); + t.strictEqual( isNumber( v.tickOpacity ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickOpacity` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + 2, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickOpacity': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickOpacity` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + 2, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickOpacity = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickOpacity` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.tickOpacity, 1, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickOpacity': 0.5 + }); + t.strictEqual( axis.tickOpacity, 0.5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickOpacity` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickOpacity = 0.5; + t.strictEqual( axis.tickOpacity, 0.5, 'returns expected value' ); + + axis.tickOpacity = 0; + t.strictEqual( axis.tickOpacity, 0, 'returns expected value' ); + + axis.tickOpacity = 1; + t.strictEqual( axis.tickOpacity, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickOpacity` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickOpacity = 0.5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickOpacity = 0; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickOpacity = 0; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js new file mode 100644 index 000000000000..4c5081613f1a --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js @@ -0,0 +1,179 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickRound` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickRound' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickRound' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.tickRound ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickRound` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickRound': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickRound` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickRound = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickRound` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.tickRound ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickRound': true + }); + t.strictEqual( axis.tickRound, true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickRound': false + }); + t.strictEqual( axis.tickRound, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickRound` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickRound = true; + t.strictEqual( axis.tickRound, true, 'returns expected value' ); + + axis.tickRound = false; + t.strictEqual( axis.tickRound, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickRound` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickRound = true; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickRound = false; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickRound = false; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js new file mode 100644 index 000000000000..e9b70065bc32 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js @@ -0,0 +1,185 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickSize` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickSize' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickSize' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.tickSize ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickSize': 5 + }); + t.strictEqual( isNumber( v.tickSize ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickSize` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickSize': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickSize` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickSize = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickSize` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.tickSize ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickSize': 5 + }); + t.strictEqual( axis.tickSize, 5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickSize` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickSize = 5; + t.strictEqual( axis.tickSize, 5, 'returns expected value' ); + + axis.tickSize = 0; + t.strictEqual( axis.tickSize, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickSize` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickSize = 5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickSize = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickSize = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js new file mode 100644 index 000000000000..63b204e0487d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js @@ -0,0 +1,185 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `tickWidth` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'tickWidth' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'tickWidth' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.tickWidth ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickWidth': 2 + }); + t.strictEqual( isNumber( v.tickWidth ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `tickWidth` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickWidth': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `tickWidth` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.tickWidth = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `tickWidth` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.tickWidth ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickWidth': 2 + }); + t.strictEqual( axis.tickWidth, 2, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `tickWidth` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.tickWidth = 2; + t.strictEqual( axis.tickWidth, 2, 'returns expected value' ); + + axis.tickWidth = 0; + t.strictEqual( axis.tickWidth, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `tickWidth` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.tickWidth = 2; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.tickWidth = 3; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.tickWidth = 3; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js new file mode 100644 index 000000000000..88ac9b4a224f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js @@ -0,0 +1,174 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `ticks` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'ticks' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'ticks' ), true, 'returns expected value' ); + t.strictEqual( isBoolean( v.ticks ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `ticks` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'ticks': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `ticks` property which throws an error if set to a non-boolean value', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.ticks = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `ticks` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.ticks, true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'ticks': false + }); + t.strictEqual( axis.ticks, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `ticks` property which can be set to a boolean', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.ticks = false; + t.strictEqual( axis.ticks, false, 'returns expected value' ); + + axis.ticks = true; + t.strictEqual( axis.ticks, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `ticks` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.ticks = false; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.ticks = true; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.ticks = true; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js new file mode 100644 index 000000000000..367763bdc256 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isArray = require( '@stdlib/assert/is-array' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `title` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'title' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'title' ), true, 'returns expected value' ); + t.strictEqual( isArray( v.title ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `title` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'title': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `title` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.title = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `title` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.deepEqual( axis.title, [ '' ], 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'title': 'Axis Title' + }); + t.deepEqual( axis.title, [ 'Axis Title' ], 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'title': [ 'Line 1', 'Line 2' ] + }); + t.deepEqual( axis.title, [ 'Line 1', 'Line 2' ], 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `title` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.title = 'Axis Title'; + t.deepEqual( axis.title, [ 'Axis Title' ], 'returns expected value' ); + + axis.title = [ 'Line 1', 'Line 2' ]; + t.deepEqual( axis.title, [ 'Line 1', 'Line 2' ], 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `title` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.title = 'Axis Title'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.title = [ 'Line 1', 'Line 2' ]; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.title = [ 'Line 1', 'Line 2' ]; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js new file mode 100644 index 000000000000..957209885899 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js @@ -0,0 +1,179 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleAlign` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleAlign' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleAlign' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleAlign ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleAlign` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAlign': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleAlign` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleAlign = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleAlign` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleAlign ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAlign': 'center' + }); + t.strictEqual( axis.titleAlign, 'center', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleAlign` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleAlign = 'left'; + t.strictEqual( axis.titleAlign, 'left', 'returns expected value' ); + + axis.titleAlign = 'center'; + t.strictEqual( axis.titleAlign, 'center', 'returns expected value' ); + + axis.titleAlign = 'right'; + t.strictEqual( axis.titleAlign, 'right', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleAlign` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleAlign = 'left'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleAlign = 'center'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleAlign = 'center'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js new file mode 100644 index 000000000000..8dc57495ba84 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js @@ -0,0 +1,178 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleAnchor` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleAnchor' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleAnchor' ), true, 'returns expected value' ); + t.strictEqual( v.titleAnchor, null, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleAnchor` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAnchor': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleAnchor` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleAnchor = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleAnchor` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.titleAnchor, null, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAnchor': 'start' + }); + t.strictEqual( axis.titleAnchor, 'start', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleAnchor` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleAnchor = 'start'; + t.strictEqual( axis.titleAnchor, 'start', 'returns expected value' ); + + axis.titleAnchor = 'end'; + t.strictEqual( axis.titleAnchor, 'end', 'returns expected value' ); + + axis.titleAnchor = null; + t.strictEqual( axis.titleAnchor, null, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleAnchor` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleAnchor = 'start'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleAnchor = 'end'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleAnchor = 'end'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js new file mode 100644 index 000000000000..be43114bf07d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleAngle` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleAngle' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleAngle' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleAngle ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAngle': 45 + }); + t.strictEqual( isNumber( v.titleAngle ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleAngle` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAngle': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleAngle` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleAngle = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleAngle` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleAngle ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAngle': 45 + }); + t.strictEqual( axis.titleAngle, 45, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleAngle` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleAngle = 45; + t.strictEqual( axis.titleAngle, 45, 'returns expected value' ); + + axis.titleAngle = 90; + t.strictEqual( axis.titleAngle, 90, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleAngle` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleAngle = 45; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleAngle = 90; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleAngle = 90; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js new file mode 100644 index 000000000000..8b3f090c2fd5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleBaseline` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleBaseline' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleBaseline' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleBaseline ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleBaseline` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleBaseline': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleBaseline` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleBaseline = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleBaseline` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleBaseline ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleBaseline': 'top' + }); + t.strictEqual( axis.titleBaseline, 'top', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleBaseline` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleBaseline = 'top'; + t.strictEqual( axis.titleBaseline, 'top', 'returns expected value' ); + + axis.titleBaseline = 'middle'; + t.strictEqual( axis.titleBaseline, 'middle', 'returns expected value' ); + + axis.titleBaseline = 'bottom'; + t.strictEqual( axis.titleBaseline, 'bottom', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleBaseline` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleBaseline = 'top'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleBaseline = 'middle'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleBaseline = 'middle'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js new file mode 100644 index 000000000000..02e7afe3e661 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleColor` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleColor' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleColor' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleColor ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleColor': 'steelblue' + }); + t.strictEqual( isString( v.titleColor ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleColor` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleColor': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleColor` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleColor = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleColor` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleColor ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleColor': 'steelblue' + }); + t.strictEqual( axis.titleColor, 'steelblue', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleColor` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleColor = 'steelblue'; + t.strictEqual( axis.titleColor, 'steelblue', 'returns expected value' ); + + axis.titleColor = 'red'; + t.strictEqual( axis.titleColor, 'red', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleColor` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleColor = 'steelblue'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleColor = 'red'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleColor = 'red'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js new file mode 100644 index 000000000000..6456cbb42c80 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleFont` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleFont' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleFont' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleFont ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFont': 'Arial' + }); + t.strictEqual( isString( v.titleFont ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleFont` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFont': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleFont` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleFont = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleFont` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleFont ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFont': 'Arial' + }); + t.strictEqual( axis.titleFont, 'Arial', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleFont` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleFont = 'Arial'; + t.strictEqual( axis.titleFont, 'Arial', 'returns expected value' ); + + axis.titleFont = 'Helvetica'; + t.strictEqual( axis.titleFont, 'Helvetica', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleFont` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleFont = 'Arial'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleFont = 'Helvetica'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleFont = 'Helvetica'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js new file mode 100644 index 000000000000..2f677878fd2f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleFontSize` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleFontSize' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleFontSize' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleFontSize ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontSize': 14 + }); + t.strictEqual( isNumber( v.titleFontSize ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleFontSize` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontSize': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleFontSize` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleFontSize = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleFontSize` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleFontSize ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontSize': 14 + }); + t.strictEqual( axis.titleFontSize, 14, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleFontSize` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleFontSize = 14; + t.strictEqual( axis.titleFontSize, 14, 'returns expected value' ); + + axis.titleFontSize = 18; + t.strictEqual( axis.titleFontSize, 18, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleFontSize` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleFontSize = 14; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleFontSize = 18; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleFontSize = 18; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js new file mode 100644 index 000000000000..3116174048f5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js @@ -0,0 +1,183 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleFontStyle` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleFontStyle' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleFontStyle' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleFontStyle ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontStyle': 'italic' + }); + t.strictEqual( isString( v.titleFontStyle ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleFontStyle` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontStyle': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleFontStyle` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleFontStyle = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleFontStyle` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleFontStyle ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontStyle': 'italic' + }); + t.strictEqual( axis.titleFontStyle, 'italic', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleFontStyle` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleFontStyle = 'italic'; + t.strictEqual( axis.titleFontStyle, 'italic', 'returns expected value' ); + + axis.titleFontStyle = 'normal'; + t.strictEqual( axis.titleFontStyle, 'normal', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleFontStyle` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleFontStyle = 'italic'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleFontStyle = 'normal'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleFontStyle = 'normal'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js new file mode 100644 index 000000000000..3cbe8448b6e7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js @@ -0,0 +1,180 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleFontWeight` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleFontWeight' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleFontWeight' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleFontWeight ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleFontWeight` option', function test( t ) { + var values; + var i; + + values = [ + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontWeight': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleFontWeight` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleFontWeight = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleFontWeight` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleFontWeight ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontWeight': 'bold' + }); + t.strictEqual( axis.titleFontWeight, 'bold', 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontWeight': 700 + }); + t.strictEqual( axis.titleFontWeight, 700, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleFontWeight` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleFontWeight = 'bold'; + t.strictEqual( axis.titleFontWeight, 'bold', 'returns expected value' ); + + axis.titleFontWeight = 700; + t.strictEqual( axis.titleFontWeight, 700, 'returns expected value' ); + + axis.titleFontWeight = 'normal'; + t.strictEqual( axis.titleFontWeight, 'normal', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleFontWeight` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleFontWeight = 'bold'; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleFontWeight = 700; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleFontWeight = 700; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js new file mode 100644 index 000000000000..2022135c1e4e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js @@ -0,0 +1,176 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleLimit` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleLimit' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleLimit' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleLimit ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleLimit` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleLimit': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleLimit` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleLimit = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleLimit` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleLimit ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleLimit': 200 + }); + t.strictEqual( axis.titleLimit, 200, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleLimit` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleLimit = 200; + t.strictEqual( axis.titleLimit, 200, 'returns expected value' ); + + axis.titleLimit = 300; + t.strictEqual( axis.titleLimit, 300, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleLimit` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleLimit = 200; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleLimit = 300; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleLimit = 300; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js new file mode 100644 index 000000000000..fda0ece34f2e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleLineHeight` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleLineHeight' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleLineHeight' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleLineHeight ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleLineHeight': 20 + }); + t.strictEqual( isNumber( v.titleLineHeight ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleLineHeight` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleLineHeight': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleLineHeight` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleLineHeight = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleLineHeight` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleLineHeight ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleLineHeight': 20 + }); + t.strictEqual( axis.titleLineHeight, 20, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleLineHeight` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleLineHeight = 20; + t.strictEqual( axis.titleLineHeight, 20, 'returns expected value' ); + + axis.titleLineHeight = 24; + t.strictEqual( axis.titleLineHeight, 24, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleLineHeight` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleLineHeight = 20; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleLineHeight = 24; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleLineHeight = 24; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js new file mode 100644 index 000000000000..93bb96b7c869 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js @@ -0,0 +1,175 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleOpacity` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleOpacity' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleOpacity' ), true, 'returns expected value' ); + t.strictEqual( isNumber( v.titleOpacity ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleOpacity` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -0.1, + 1.1, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleOpacity': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleOpacity` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -0.1, + 1.1, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleOpacity = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleOpacity` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.titleOpacity, 1, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleOpacity': 0.5 + }); + t.strictEqual( axis.titleOpacity, 0.5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleOpacity` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleOpacity = 0.5; + t.strictEqual( axis.titleOpacity, 0.5, 'returns expected value' ); + + axis.titleOpacity = 0; + t.strictEqual( axis.titleOpacity, 0, 'returns expected value' ); + + axis.titleOpacity = 1; + t.strictEqual( axis.titleOpacity, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleOpacity` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleOpacity = 0.5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleOpacity = 0.3; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleOpacity = 0.3; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js new file mode 100644 index 000000000000..6b8dcede67e7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titlePadding` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titlePadding' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titlePadding' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titlePadding ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titlePadding': 10 + }); + t.strictEqual( isNumber( v.titlePadding ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titlePadding` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titlePadding': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titlePadding` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titlePadding = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titlePadding` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titlePadding ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titlePadding': 10 + }); + t.strictEqual( axis.titlePadding, 10, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titlePadding` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titlePadding = 10; + t.strictEqual( axis.titlePadding, 10, 'returns expected value' ); + + axis.titlePadding = 20; + t.strictEqual( axis.titlePadding, 20, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titlePadding` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titlePadding = 10; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titlePadding = 20; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titlePadding = 20; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js new file mode 100644 index 000000000000..eff472e89e12 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleX` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleX' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleX' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleX ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleX': 100 + }); + t.strictEqual( isNumber( v.titleX ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleX` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleX': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleX` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleX = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleX` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleX ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleX': 100 + }); + t.strictEqual( axis.titleX, 100, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleX` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleX = 100; + t.strictEqual( axis.titleX, 100, 'returns expected value' ); + + axis.titleX = 200; + t.strictEqual( axis.titleX, 200, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleX` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleX = 100; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleX = 200; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleX = 200; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js new file mode 100644 index 000000000000..4617d685dfcd --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js @@ -0,0 +1,181 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var isUndefined = require( '@stdlib/assert/is-undefined' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `titleY` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'titleY' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'titleY' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.titleY ), true, 'returns expected value' ); + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleY': 50 + }); + t.strictEqual( isNumber( v.titleY ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `titleY` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleY': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `titleY` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.titleY = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `titleY` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( isUndefined( axis.titleY ), true, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleY': 50 + }); + t.strictEqual( axis.titleY, 50, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `titleY` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.titleY = 50; + t.strictEqual( axis.titleY, 50, 'returns expected value' ); + + axis.titleY = 100; + t.strictEqual( axis.titleY, 100, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `titleY` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.titleY = 50; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.titleY = 100; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.titleY = 100; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js new file mode 100644 index 000000000000..5542c7573f28 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js @@ -0,0 +1,174 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `translate` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'translate' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'translate' ), true, 'returns expected value' ); + t.strictEqual( isNumber( v.translate ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `translate` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'translate': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `translate` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.translate = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `translate` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.translate, 0.5, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'translate': 1 + }); + t.strictEqual( axis.translate, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `translate` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.translate = 1; + t.strictEqual( axis.translate, 1, 'returns expected value' ); + + axis.translate = 0; + t.strictEqual( axis.translate, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `translate` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.translate = 1; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.translate = 0; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.translate = 0; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js new file mode 100644 index 000000000000..6e608ae39c52 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js @@ -0,0 +1,174 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Axis = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Axis, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `zindex` property', function test( t ) { + var v; + + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( hasOwnProp( v, 'zindex' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'zindex' ), true, 'returns expected value' ); + t.strictEqual( isNumber( v.zindex ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `zindex` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'zindex': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `zindex` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + axis.zindex = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `zindex` property', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + t.strictEqual( axis.zindex, 0, 'returns expected value' ); + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'zindex': 5 + }); + t.strictEqual( axis.zindex, 5, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `zindex` property which can be set to a valid value', function test( t ) { + var axis; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + + axis.zindex = 5; + t.strictEqual( axis.zindex, 5, 'returns expected value' ); + + axis.zindex = 10; + t.strictEqual( axis.zindex, 10, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `zindex` property is set to a new value', function test( t ) { + var axis; + var count; + + axis = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom' + }); + count = 0; + + axis.on( 'change', onChange ); + + axis.zindex = 5; + t.strictEqual( count, 1, 'returns expected value' ); + + axis.zindex = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + axis.zindex = 10; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); From 60c07d5178198fdf42d931e2bc7296ad069929b2 Mon Sep 17 00:00:00 2001 From: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com> Date: Mon, 2 Mar 2026 21:44:28 +0530 Subject: [PATCH 02/12] Update lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js Co-authored-by: Gururaj Gurram <143020143+gururaj1512@users.noreply.github.com> Signed-off-by: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com> --- lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js index 688abf2e5a4b..001f13018600 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js @@ -152,8 +152,8 @@ tape( 'the constructor returns an instance having a `aria` property which can be }); tape( 'the constructor returns an instance which emits an event when the `aria` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', From 37c64cb4f3410f25a37e2eb7d1f74e11266e8fa2 Mon Sep 17 00:00:00 2001 From: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com> Date: Mon, 2 Mar 2026 21:44:36 +0530 Subject: [PATCH 03/12] Update lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js Co-authored-by: Gururaj Gurram <143020143+gururaj1512@users.noreply.github.com> Signed-off-by: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com> --- .../@stdlib/plot/vega/axis/ctor/test/test.band_position.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js index 25c26578a2ac..411185817431 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js @@ -63,6 +63,11 @@ tape( 'the constructor throws an error if provided an invalid `bandPosition` opt values = [ 'beep', + 'boop', + null, + true, + false, + [], -0.1, 1.1, NaN, From 83e8bf918c2d6d0c85b67100c0687787369d6b5f Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Mon, 2 Mar 2026 22:14:16 +0530 Subject: [PATCH 04/12] update: revert changes --- lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js index 5a26d589ddf3..de63bbe71f26 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js @@ -22,7 +22,7 @@ var Axis = require( './../lib' ); var axis = new Axis({ 'scale': 'xScale', - 'orient': 'bottom' + 'orient': 'bottom', }); console.log( axis.toJSON() ); From 1a4db27166987fc9ef8dd0462986ce28d0c0fb5f Mon Sep 17 00:00:00 2001 From: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com> Date: Mon, 2 Mar 2026 22:15:15 +0530 Subject: [PATCH 05/12] Fix formatting in axis example Signed-off-by: Sachin Pangal <151670745+Sachinn-64@users.noreply.github.com> --- lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js index de63bbe71f26..5a26d589ddf3 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/examples/index.js @@ -22,7 +22,7 @@ var Axis = require( './../lib' ); var axis = new Axis({ 'scale': 'xScale', - 'orient': 'bottom', + 'orient': 'bottom' }); console.log( axis.toJSON() ); From fe9183a06339680eb2f0181cae11e82e44bd2e4a Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Mon, 2 Mar 2026 22:18:58 +0530 Subject: [PATCH 06/12] update: revert changes --- .../@stdlib/plot/vega/axis/ctor/test/test.band_position.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js index 411185817431..be00977f87f3 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js @@ -64,10 +64,6 @@ tape( 'the constructor throws an error if provided an invalid `bandPosition` opt values = [ 'beep', 'boop', - null, - true, - false, - [], -0.1, 1.1, NaN, From 50ae1d6a58c756905c23f0825699bd76aec070b4 Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Sat, 7 Mar 2026 11:53:18 +0530 Subject: [PATCH 07/12] chore: suggested changes --- .../@stdlib/plot/vega/axis/ctor/test/test.band_position.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js index be00977f87f3..411185817431 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js @@ -64,6 +64,10 @@ tape( 'the constructor throws an error if provided an invalid `bandPosition` opt values = [ 'beep', 'boop', + null, + true, + false, + [], -0.1, 1.1, NaN, From eed4ff0952a9f042794f237b3007011c7036a0b7 Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Sat, 28 Mar 2026 01:57:17 +0530 Subject: [PATCH 08/12] chore: suggested changes --- .../plot/vega/axis/ctor/test/test.aria.js | 31 - .../vega/axis/ctor/test/test.band_position.js | 36 +- .../vega/axis/ctor/test/test.description.js | 32 - .../plot/vega/axis/ctor/test/test.domain.js | 31 - .../vega/axis/ctor/test/test.domain_cap.js | 34 - .../vega/axis/ctor/test/test.domain_color.js | 31 - .../vega/axis/ctor/test/test.domain_dash.js | 32 - .../axis/ctor/test/test.domain_dash_offset.js | 32 +- .../axis/ctor/test/test.domain_opacity.js | 32 +- .../vega/axis/ctor/test/test.domain_width.js | 36 +- .../plot/vega/axis/ctor/test/test.format.js | 37 +- .../vega/axis/ctor/test/test.format_type.js | 39 +- .../plot/vega/axis/ctor/test/test.grid.js | 31 - .../plot/vega/axis/ctor/test/test.grid_cap.js | 34 - .../vega/axis/ctor/test/test.grid_color.js | 31 - .../vega/axis/ctor/test/test.grid_dash.js | 32 - .../axis/ctor/test/test.grid_dash_offset.js | 32 +- .../vega/axis/ctor/test/test.grid_opacity.js | 36 +- .../vega/axis/ctor/test/test.grid_scale.js | 31 - .../vega/axis/ctor/test/test.grid_width.js | 36 +- .../@stdlib/plot/vega/axis/ctor/test/test.js | 2343 ++++++++++++++++- .../vega/axis/ctor/test/test.label_align.js | 31 - .../vega/axis/ctor/test/test.label_angle.js | 32 +- .../axis/ctor/test/test.label_baseline.js | 40 +- .../vega/axis/ctor/test/test.label_bound.js | 29 - .../vega/axis/ctor/test/test.label_color.js | 31 - .../vega/axis/ctor/test/test.label_flush.js | 40 +- .../axis/ctor/test/test.label_flush_offset.js | 33 +- .../vega/axis/ctor/test/test.label_font.js | 31 - .../axis/ctor/test/test.label_font_size.js | 32 +- .../axis/ctor/test/test.label_font_style.js | 31 - .../axis/ctor/test/test.label_font_weight.js | 41 +- .../vega/axis/ctor/test/test.label_limit.js | 38 +- .../axis/ctor/test/test.label_line_height.js | 32 +- .../vega/axis/ctor/test/test.label_offset.js | 32 +- .../vega/axis/ctor/test/test.label_opacity.js | 36 +- .../vega/axis/ctor/test/test.label_overlap.js | 44 +- .../vega/axis/ctor/test/test.label_padding.js | 32 +- .../axis/ctor/test/test.label_separation.js | 37 +- .../plot/vega/axis/ctor/test/test.labels.js | 31 - .../vega/axis/ctor/test/test.max_extent.js | 36 +- .../vega/axis/ctor/test/test.min_extent.js | 36 +- .../plot/vega/axis/ctor/test/test.offset.js | 32 +- .../plot/vega/axis/ctor/test/test.orient.js | 34 - .../plot/vega/axis/ctor/test/test.position.js | 33 +- .../plot/vega/axis/ctor/test/test.scale.js | 31 - .../vega/axis/ctor/test/test.tick_band.js | 40 +- .../plot/vega/axis/ctor/test/test.tick_cap.js | 34 - .../vega/axis/ctor/test/test.tick_color.js | 31 - .../vega/axis/ctor/test/test.tick_count.js | 48 +- .../vega/axis/ctor/test/test.tick_dash.js | 32 - .../axis/ctor/test/test.tick_dash_offset.js | 32 +- .../vega/axis/ctor/test/test.tick_extra.js | 38 +- .../vega/axis/ctor/test/test.tick_min_step.js | 32 +- .../vega/axis/ctor/test/test.tick_offset.js | 32 +- .../vega/axis/ctor/test/test.tick_opacity.js | 35 +- .../vega/axis/ctor/test/test.tick_round.js | 37 +- .../vega/axis/ctor/test/test.tick_size.js | 36 +- .../vega/axis/ctor/test/test.tick_width.js | 36 +- .../plot/vega/axis/ctor/test/test.ticks.js | 31 - .../plot/vega/axis/ctor/test/test.title.js | 32 - .../vega/axis/ctor/test/test.title_align.js | 39 +- .../vega/axis/ctor/test/test.title_anchor.js | 41 +- .../vega/axis/ctor/test/test.title_angle.js | 32 +- .../axis/ctor/test/test.title_baseline.js | 40 +- .../vega/axis/ctor/test/test.title_color.js | 31 - .../vega/axis/ctor/test/test.title_font.js | 31 - .../axis/ctor/test/test.title_font_size.js | 32 +- .../axis/ctor/test/test.title_font_style.js | 31 - .../axis/ctor/test/test.title_font_weight.js | 41 +- .../vega/axis/ctor/test/test.title_limit.js | 38 +- .../axis/ctor/test/test.title_line_height.js | 32 +- .../vega/axis/ctor/test/test.title_opacity.js | 32 +- .../vega/axis/ctor/test/test.title_padding.js | 32 +- .../plot/vega/axis/ctor/test/test.title_x.js | 32 +- .../plot/vega/axis/ctor/test/test.title_y.js | 32 +- .../vega/axis/ctor/test/test.translate.js | 33 +- .../plot/vega/axis/ctor/test/test.zindex.js | 33 +- 78 files changed, 2543 insertions(+), 2429 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js index 001f13018600..e365efbe1efc 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isBoolean = require( '@stdlib/assert/is-boolean' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,36 +47,6 @@ tape( 'the constructor returns an instance which has a `aria` property', functio t.end(); }); -tape( 'the constructor throws an error if provided an invalid `aria` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'aria': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `aria` property which throws an error if set to a non-boolean value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js index 411185817431..1ef7120520b0 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,39 +56,6 @@ tape( 'the constructor returns an instance which has a `bandPosition` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `bandPosition` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - null, - true, - false, - [], - -0.1, - 1.1, - NaN, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'bandPosition': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `bandPosition` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js index 71a0977e15e2..df21571d7737 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,37 +47,6 @@ tape( 'the constructor returns an instance which has a `description` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `description` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'description': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `description` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js index 43c0812d657a..aa80459e183b 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isBoolean = require( '@stdlib/assert/is-boolean' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,36 +47,6 @@ tape( 'the constructor returns an instance which has a `domain` property', funct t.end(); }); -tape( 'the constructor throws an error if provided an invalid `domain` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'domain': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `domain` property which throws an error if set to a non-boolean value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js index 880f0eb24f01..766af4f44a73 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,39 +47,6 @@ tape( 'the constructor returns an instance which has a `domainCap` property', fu t.end(); }); -tape( 'the constructor throws an error if provided an invalid `domainCap` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'domainCap': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `domainCap` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js index d2f8f3ceaf7f..0a1d1e655036 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js @@ -27,7 +27,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,36 +56,6 @@ tape( 'the constructor returns an instance which has a `domainColor` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `domainColor` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'domainColor': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `domainColor` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js index 4b55762db3a9..f049a45e0e47 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isArray = require( '@stdlib/assert/is-array' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,37 +47,6 @@ tape( 'the constructor returns an instance which has a `domainDash` property', f t.end(); }); -tape( 'the constructor throws an error if provided an invalid `domainDash` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 5, - NaN, - null, - void 0, - true, - false, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'domainDash': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `domainDash` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js index 864895387d30..ba6d697141bf 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `domainDashOffset` proper t.end(); }); -tape( 'the constructor throws an error if provided an invalid `domainDashOffset` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'domainDashOffset': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `domainDashOffset` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js index 4698682ab495..fe892f25031a 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js @@ -23,10 +23,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,35 +47,6 @@ tape( 'the constructor returns an instance which has a `domainOpacity` property' t.end(); }); -tape( 'the constructor throws an error if provided an invalid `domainOpacity` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -1, - 2, - NaN, - void 0, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'domainOpacity': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `domainOpacity` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js index 7e8cda71604d..99dd91e12030 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -52,42 +51,11 @@ tape( 'the constructor returns an instance which has a `domainWidth` property', 'orient': 'bottom', 'domainWidth': 2 }); - t.strictEqual( isNumber( v.domainWidth ), true, 'returns expected value' ); + t.strictEqual( isNonNegativeNumber( v.domainWidth ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `domainWidth` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -1, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'domainWidth': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `domainWidth` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js index 6aa9ba15ded6..d59b9f1d6ab7 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js @@ -24,9 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,38 +45,15 @@ tape( 'the constructor returns an instance which has a `format` property', funct t.strictEqual( hasOwnProp( v, 'format' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'format' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.format ), true, 'returns expected value' ); + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'format': '.2f' + }); + t.strictEqual( isString( v.format ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `format` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'format': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `format` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js index 597033bea804..d37e29948f20 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js @@ -24,9 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,40 +45,15 @@ tape( 'the constructor returns an instance which has a `formatType` property', f t.strictEqual( hasOwnProp( v, 'formatType' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'formatType' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.formatType ), true, 'returns expected value' ); + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'formatType': 'number' + }); + t.strictEqual( isString( v.formatType ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `formatType` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'formatType': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `formatType` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js index dea2ca0ad1b0..50b5d00583a1 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isBoolean = require( '@stdlib/assert/is-boolean' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,36 +47,6 @@ tape( 'the constructor returns an instance which has a `grid` property', functio t.end(); }); -tape( 'the constructor throws an error if provided an invalid `grid` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'grid': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `grid` property which throws an error if set to a non-boolean value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js index 27a088212c01..4e0bdb2b97c8 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,39 +47,6 @@ tape( 'the constructor returns an instance which has a `gridCap` property', func t.end(); }); -tape( 'the constructor throws an error if provided an invalid `gridCap` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'gridCap': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `gridCap` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js index 20bc2e654f92..1727c882c051 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js @@ -27,7 +27,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,36 +56,6 @@ tape( 'the constructor returns an instance which has a `gridColor` property', fu t.end(); }); -tape( 'the constructor throws an error if provided an invalid `gridColor` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'gridColor': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `gridColor` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js index e02b47153868..59156d314865 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isArray = require( '@stdlib/assert/is-array' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,37 +47,6 @@ tape( 'the constructor returns an instance which has a `gridDash` property', fun t.end(); }); -tape( 'the constructor throws an error if provided an invalid `gridDash` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 5, - NaN, - null, - void 0, - true, - false, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'gridDash': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `gridDash` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js index 2341e6d453a8..d0dca20b500a 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `gridDashOffset` property t.end(); }); -tape( 'the constructor throws an error if provided an invalid `gridDashOffset` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'gridDashOffset': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `gridDashOffset` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js index 813a5ceeaf91..a23daa38deb7 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js @@ -23,10 +23,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,41 +47,16 @@ tape( 'the constructor returns an instance which has a `gridOpacity` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `gridOpacity` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -1, - 2, - NaN, - void 0, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'gridOpacity': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `gridOpacity` property which throws an error if set to an invalid value', function test( t ) { var values; var i; values = [ 'beep', + 'boop', + null, + true, + false, -1, 2, NaN, diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js index f2cf775e796e..0c4e5359ea5c 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js @@ -27,7 +27,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,36 +56,6 @@ tape( 'the constructor returns an instance which has a `gridScale` property', fu t.end(); }); -tape( 'the constructor throws an error if provided an invalid `gridScale` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'gridScale': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `gridScale` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js index e9d18bb910dd..4dd996416e5a 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -52,42 +51,11 @@ tape( 'the constructor returns an instance which has a `gridWidth` property', fu 'orient': 'bottom', 'gridWidth': 2 }); - t.strictEqual( isNumber( v.gridWidth ), true, 'returns expected value' ); + t.strictEqual( isNonNegativeNumber( v.gridWidth ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `gridWidth` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -1, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'gridWidth': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `gridWidth` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.js index ed29584d2f49..64c57ac380e8 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.js @@ -20,9 +20,9 @@ // MODULES // +var EventEmitter = require( 'events' ).EventEmitter; var tape = require( 'tape' ); var instanceOf = require( '@stdlib/assert/instance-of' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var Axis = require( './../lib' ); @@ -120,6 +120,2331 @@ tape( 'the constructor throws an error if not provided an `orient` option', func } }); + +tape( 'the constructor throws an error if provided an invalid `aria` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'aria': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `bandPosition` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + null, + true, + false, + [], + -0.1, + 1.1, + NaN, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'bandPosition': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `description` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'description': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `domain` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domain': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `domainCap` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainCap': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `domainColor` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainColor': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `domainDash` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + true, + false, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainDash': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `domainDashOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainDashOffset': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `domainOpacity` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + 2, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainOpacity': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `domainWidth` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'domainWidth': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `format` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'format': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `formatType` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'formatType': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `grid` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'grid': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `gridCap` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridCap': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `gridColor` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridColor': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `gridDash` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + true, + false, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridDash': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `gridDashOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridDashOffset': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `gridOpacity` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + null, + true, + false, + -1, + 2, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridOpacity': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `gridScale` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridScale': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `gridWidth` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'gridWidth': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelAlign` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelAlign': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelAngle` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelAngle': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelBaseline` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelBaseline': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelBound` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelBound': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelColor` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelColor': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelFlush` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFlush': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelFlushOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFlushOffset': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelFont` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFont': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelFontSize` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontSize': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelFontStyle` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontStyle': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelFontWeight` option', function test( t ) { + var values; + var i; + + values = [ + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontWeight': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelLimit` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelLimit': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelLineHeight` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelLineHeight': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOffset': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelOpacity` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + null, + true, + false, + -0.1, + 1.1, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOpacity': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelOverlap` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOverlap': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelPadding` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelPadding': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labelSeparation` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labelSeparation': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `labels` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'labels': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `maxExtent` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'maxExtent': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `minExtent` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'minExtent': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `offset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'offset': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `orient` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'BOTTOM', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `position` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'position': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `scale` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': value, + 'orient': 'bottom' + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickBand` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickBand': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickCap` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickCap': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickColor` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickColor': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickCount` option', function test( t ) { + var values; + var i; + + values = [ + null, + true, + false, + [], + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickCount': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickDash` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + void 0, + true, + false, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickDash': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickDashOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickDashOffset': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickExtra` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickExtra': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickMinStep` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickMinStep': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickOffset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickOffset': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickOpacity` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + null, + true, + false, + -1, + 2, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickOpacity': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickRound` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickRound': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickSize` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickSize': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `tickWidth` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'tickWidth': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `ticks` option', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'ticks': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `title` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'title': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleAlign` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAlign': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleAnchor` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 5, + NaN, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAnchor': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleAngle` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAngle': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleBaseline` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleBaseline': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleColor` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleColor': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleFont` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFont': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleFontSize` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontSize': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleFontStyle` option', function test( t ) { + var values; + var i; + + values = [ + 5, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontStyle': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleFontWeight` option', function test( t ) { + var values; + var i; + + values = [ + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontWeight': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleLimit` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -1, + NaN, + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleLimit': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleLineHeight` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleLineHeight': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleOpacity` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + -0.1, + 1.1, + NaN, + void 0, + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleOpacity': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titlePadding` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titlePadding': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleX` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleX': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `titleY` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'titleY': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `translate` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'translate': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `zindex` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + var axis = new Axis({ // eslint-disable-line no-unused-vars + 'scale': 'xScale', + 'orient': 'bottom', + 'zindex': value + }); + }; + } +}); + tape( 'the constructor has a read-only `name` property', function test( t ) { t.strictEqual( Axis.name, 'Axis', 'returns expected value' ); t.end(); @@ -382,18 +2707,12 @@ tape( 'the `toJSON` method is implicitly invoked by `JSON.stringify`', function t.end(); }); -tape( 'the constructor returns an instance which inherits from EventEmitter', function test( t ) { - var axis; - - axis = new Axis({ +tape( 'the constructor returns an instance which is an EventEmitter', function test( t ) { + var axis = new Axis({ 'scale': 'xScale', 'orient': 'bottom' }); - - t.strictEqual( typeof axis.on, 'function', 'returns expected value' ); - t.strictEqual( typeof axis.emit, 'function', 'returns expected value' ); - t.strictEqual( typeof axis.removeListener, 'function', 'returns expected value' ); - + t.strictEqual( instanceOf( axis, EventEmitter ), true, 'returns expected value' ); t.end(); }); @@ -408,8 +2727,8 @@ tape( 'the constructor ignores unrecognized options', function test( t ) { }); t.strictEqual( axis.scale, 'xScale', 'returns expected value' ); - t.strictEqual( hasOwnProp( axis, 'beep' ), false, 'returns expected value' ); - t.strictEqual( hasOwnProp( axis, 'foo' ), false, 'returns expected value' ); + t.strictEqual( axis.beep, void 0, 'returns expected value' ); + t.strictEqual( axis.foo, void 0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js index 186d1454d82e..1f945478f5c4 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js @@ -27,7 +27,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,36 +56,6 @@ tape( 'the constructor returns an instance which has a `labelAlign` property', f t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelAlign` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelAlign': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelAlign` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js index bf8d13bae7ac..aae5cade7c92 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `labelAngle` property', f t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelAngle` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelAngle': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelAngle` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js index 5a37a7236a7c..fa570bf8954e 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js @@ -24,9 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,41 +45,15 @@ tape( 'the constructor returns an instance which has a `labelBaseline` property' t.strictEqual( hasOwnProp( v, 'labelBaseline' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'labelBaseline' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.labelBaseline ), true, 'returns expected value' ); + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelBaseline': 'top' + }); + t.strictEqual( isString( v.labelBaseline ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelBaseline` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelBaseline': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelBaseline` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js index 6025ab2ea044..b94ae5fe7ae5 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js @@ -25,7 +25,6 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -46,34 +45,6 @@ tape( 'the constructor returns an instance which has a `labelBound` property', f t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelBound` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelBound': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelBound` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js index b2e8323bc47a..3e866e79e729 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js @@ -27,7 +27,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,36 +56,6 @@ tape( 'the constructor returns an instance which has a `labelColor` property', f t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelColor` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelColor': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelColor` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js index cdb8825a57a9..38dc077868f4 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,34 +46,21 @@ tape( 'the constructor returns an instance which has a `labelFlush` property', f t.strictEqual( hasOwnProp( v, 'labelFlush' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'labelFlush' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.labelFlush ), true, 'returns expected value' ); - t.end(); -}); -tape( 'the constructor throws an error if provided an invalid `labelFlush` option', function test( t ) { - var values; - var i; + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFlush': true + }); + t.strictEqual( isBoolean( v.labelFlush ), true, 'returns expected value' ); - values = [ - 'beep', - null, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFlush': 10 + }); + t.strictEqual( isNumber( v.labelFlush ), true, 'returns expected value' ); t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelFlush': value - }); - }; - } }); tape( 'the constructor returns an instance having a `labelFlush` property which throws an error if set to an invalid value', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js index 7744a4173a12..e1bd886fa6ca 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js @@ -23,10 +23,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,36 +47,6 @@ tape( 'the constructor returns an instance which has a `labelFlushOffset` proper t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelFlushOffset` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelFlushOffset': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelFlushOffset` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js index 00488fda76cc..9033ad785fc6 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js @@ -27,7 +27,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,36 +56,6 @@ tape( 'the constructor returns an instance which has a `labelFont` property', fu t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelFont` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelFont': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelFont` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js index a09d3c60e65a..88911ea28970 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `labelFontSize` property' t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelFontSize` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelFontSize': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelFontSize` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js index 14307bb5abdb..08d98f26f853 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js @@ -27,7 +27,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,36 +56,6 @@ tape( 'the constructor returns an instance which has a `labelFontStyle` property t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelFontStyle` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelFontStyle': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelFontStyle` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js index bde53ae90d92..e3154dee6f3d 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,35 +46,21 @@ tape( 'the constructor returns an instance which has a `labelFontWeight` propert t.strictEqual( hasOwnProp( v, 'labelFontWeight' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'labelFontWeight' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.labelFontWeight ), true, 'returns expected value' ); - t.end(); -}); -tape( 'the constructor throws an error if provided an invalid `labelFontWeight` option', function test( t ) { - var values; - var i; + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontWeight': 'bold' + }); + t.strictEqual( isString( v.labelFontWeight ), true, 'returns expected value' ); - values = [ - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelFontWeight': 700 + }); + t.strictEqual( isNumber( v.labelFontWeight ), true, 'returns expected value' ); t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelFontWeight': value - }); - }; - } }); tape( 'the constructor returns an instance having a `labelFontWeight` property which throws an error if set to an invalid value', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js index 387922b60064..0657151e733d 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js @@ -24,9 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,38 +45,14 @@ tape( 'the constructor returns an instance which has a `labelLimit` property', f t.strictEqual( hasOwnProp( v, 'labelLimit' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'labelLimit' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.labelLimit ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor throws an error if provided an invalid `labelLimit` option', function test( t ) { - var values; - var i; - values = [ - 'beep', - -1, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelLimit': 120 + }); + t.strictEqual( isNonNegativeNumber( v.labelLimit ), true, 'returns expected value' ); t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelLimit': value - }); - }; - } }); tape( 'the constructor returns an instance having a `labelLimit` property which throws an error if set to an invalid value', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js index 67d487bc4f32..2d39a1a3b3b4 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `labelLineHeight` propert t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelLineHeight` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelLineHeight': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelLineHeight` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js index 48f6081c62f3..d6e0aac854e0 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `labelOffset` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelOffset` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelOffset': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelOffset` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js index 524db85d26a8..dace2affcea0 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js @@ -23,10 +23,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,41 +47,16 @@ tape( 'the constructor returns an instance which has a `labelOpacity` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelOpacity` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -0.1, - 1.1, - NaN, - void 0, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelOpacity': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelOpacity` property which throws an error if set to an invalid value', function test( t ) { var values; var i; values = [ 'beep', + 'boop', + null, + true, + false, -0.1, 1.1, NaN, diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js index 4a2320d27bd0..5a2da435e111 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -43,37 +44,22 @@ tape( 'the constructor returns an instance which has a `labelOverlap` property', }); t.strictEqual( hasOwnProp( v, 'labelOverlap' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'labelOverlap' ), true, 'returns expected value' ); - t.end(); -}); -tape( 'the constructor throws an error if provided an invalid `labelOverlap` option', function test( t ) { - var values; - var i; + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOverlap': true + }); + t.strictEqual( isBoolean( v.labelOverlap ), true, 'returns expected value' ); - values = [ - 'beep', - 5, - NaN, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'labelOverlap': 'parity' + }); + t.strictEqual( isString( v.labelOverlap ), true, 'returns expected value' ); - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelOverlap': value - }); - }; - } + t.end(); }); tape( 'the constructor returns an instance having a `labelOverlap` property which throws an error if set to an invalid value', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js index f59b8777ea14..3bfb175662ba 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `labelPadding` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labelPadding` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelPadding': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labelPadding` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js index 17a9cc402e01..f05bae7d9f82 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js @@ -23,10 +23,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -44,40 +43,8 @@ tape( 'the constructor returns an instance which has a `labelSeparation` propert }); t.strictEqual( hasOwnProp( v, 'labelSeparation' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'labelSeparation' ), true, 'returns expected value' ); - t.strictEqual( isNumber( v.labelSeparation ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor throws an error if provided an invalid `labelSeparation` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -1, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } + t.strictEqual( isNonNegativeNumber( v.labelSeparation ), true, 'returns expected value' ); t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labelSeparation': value - }); - }; - } }); tape( 'the constructor returns an instance having a `labelSeparation` property which throws an error if set to an invalid value', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js index ccf05550d1b2..7216f5120d06 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isBoolean = require( '@stdlib/assert/is-boolean' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,36 +47,6 @@ tape( 'the constructor returns an instance which has a `labels` property', funct t.end(); }); -tape( 'the constructor throws an error if provided an invalid `labels` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'labels': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `labels` property which throws an error if set to a non-boolean value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js index b27489af8260..fac98a412476 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -52,42 +51,11 @@ tape( 'the constructor returns an instance which has a `maxExtent` property', fu 'orient': 'bottom', 'maxExtent': 200 }); - t.strictEqual( isNumber( v.maxExtent ), true, 'returns expected value' ); + t.strictEqual( isNonNegativeNumber( v.maxExtent ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `maxExtent` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -1, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'maxExtent': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `maxExtent` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js index b9c33f9ece24..a1508c876808 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -52,42 +51,11 @@ tape( 'the constructor returns an instance which has a `minExtent` property', fu 'orient': 'bottom', 'minExtent': 50 }); - t.strictEqual( isNumber( v.minExtent ), true, 'returns expected value' ); + t.strictEqual( isNonNegativeNumber( v.minExtent ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `minExtent` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -1, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'minExtent': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `minExtent` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js index 1fc1189ca118..368fbfae1f2c 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has an `offset` property', func t.end(); }); -tape( 'the constructor throws an error if provided an invalid `offset` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'offset': value - }); - }; - } -}); - tape( 'the constructor returns an instance having an `offset` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js index d9fd3826f05c..1b39a23f24d3 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,39 +47,6 @@ tape( 'the constructor returns an instance which has a `orient` property', funct t.end(); }); -tape( 'the constructor throws an error if provided an invalid `orient` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'BOTTOM', - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `orient` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js index 4ad9efbb9b1f..85992fbb2071 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js @@ -23,10 +23,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,36 +47,6 @@ tape( 'the constructor returns an instance which has a `position` property', fun t.end(); }); -tape( 'the constructor throws an error if provided an invalid `position` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'position': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `position` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js index fdb876e29f5a..b5a12a3f8835 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,36 +47,6 @@ tape( 'the constructor returns an instance which has a `scale` property', functi t.end(); }); -tape( 'the constructor throws an error if provided an invalid `scale` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': value, - 'orient': 'bottom' - }); - }; - } -}); - tape( 'the constructor returns an instance having a `scale` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js index ff1841d2221b..f71ca54dea94 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js @@ -24,9 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,41 +45,15 @@ tape( 'the constructor returns an instance which has a `tickBand` property', fun t.strictEqual( hasOwnProp( v, 'tickBand' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'tickBand' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.tickBand ), true, 'returns expected value' ); + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickBand': 'center' + }); + t.strictEqual( isString( v.tickBand ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `tickBand` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickBand': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `tickBand` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js index 338cdad68576..c28856f66583 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,39 +47,6 @@ tape( 'the constructor returns an instance which has a `tickCap` property', func t.end(); }); -tape( 'the constructor throws an error if provided an invalid `tickCap` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickCap': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `tickCap` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js index 205429b0ddad..dd329e364ed6 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js @@ -27,7 +27,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,36 +56,6 @@ tape( 'the constructor returns an instance which has a `tickColor` property', fu t.end(); }); -tape( 'the constructor throws an error if provided an invalid `tickColor` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickColor': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `tickColor` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js index 2cb51259732b..bcce4b21d0de 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js @@ -24,9 +24,11 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isObject = require( '@stdlib/assert/is-object' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,34 +47,28 @@ tape( 'the constructor returns an instance which has a `tickCount` property', fu t.strictEqual( hasOwnProp( v, 'tickCount' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'tickCount' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.tickCount ), true, 'returns expected value' ); - t.end(); -}); -tape( 'the constructor throws an error if provided an invalid `tickCount` option', function test( t ) { - var values; - var i; + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickCount': 10 + }); + t.strictEqual( isNumber( v.tickCount ), true, 'returns expected value' ); - values = [ - null, - true, - false, - [], - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickCount': 'day' + }); + t.strictEqual( isString( v.tickCount ), true, 'returns expected value' ); - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickCount': value - }); - }; - } + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickCount': { 'interval': 'Month' } + }); + t.strictEqual( isObject( v.tickCount ), true, 'returns expected value' ); + t.end(); }); tape( 'the constructor returns an instance having a `tickCount` property which throws an error if set to an invalid value', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js index e1abc862e11c..353edab3dcc7 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isArray = require( '@stdlib/assert/is-array' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,37 +47,6 @@ tape( 'the constructor returns an instance which has a `tickDash` property', fun t.end(); }); -tape( 'the constructor throws an error if provided an invalid `tickDash` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 5, - NaN, - null, - void 0, - true, - false, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickDash': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `tickDash` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js index e649bfe79af7..cc7d3d64281c 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `tickDashOffset` property t.end(); }); -tape( 'the constructor throws an error if provided an invalid `tickDashOffset` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickDashOffset': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `tickDashOffset` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js index dce007e7efb6..fa2bd6cfa559 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js @@ -24,9 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -44,37 +44,15 @@ tape( 'the constructor returns an instance which has a `tickExtra` property', fu }); t.strictEqual( hasOwnProp( v, 'tickExtra' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'tickExtra' ), true, 'returns expected value' ); - t.strictEqual( isUndefined( v.tickExtra ), true, 'returns expected value' ); - t.end(); -}); -tape( 'the constructor throws an error if provided an invalid `tickExtra` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } + t.strictEqual( isUndefined( v.tickExtra ), true, 'returns expected value' ); + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickExtra': true + }); + t.strictEqual( isBoolean( v.tickExtra ), true, 'returns expected value' ); t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickExtra': value - }); - }; - } }); tape( 'the constructor returns an instance having a `tickExtra` property which throws an error if set to an invalid value', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js index f3fa1dfea0d5..2197bbcc15a1 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `tickMinStep` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `tickMinStep` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickMinStep': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `tickMinStep` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js index fe5a69ed96a8..36748f2eda72 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `tickOffset` property', f t.end(); }); -tape( 'the constructor throws an error if provided an invalid `tickOffset` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickOffset': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `tickOffset` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_opacity.js index d5a6a528512b..a57acb643d77 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_opacity.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_opacity.js @@ -23,7 +23,7 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); @@ -48,41 +48,16 @@ tape( 'the constructor returns an instance which has a `tickOpacity` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `tickOpacity` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -1, - 2, - NaN, - void 0, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickOpacity': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `tickOpacity` property which throws an error if set to an invalid value', function test( t ) { var values; var i; values = [ 'beep', + 'boop', + null, + true, + false, -1, 2, NaN, diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js index 4c5081613f1a..53489e5b26ed 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js @@ -24,9 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,38 +45,15 @@ tape( 'the constructor returns an instance which has a `tickRound` property', fu t.strictEqual( hasOwnProp( v, 'tickRound' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'tickRound' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.tickRound ), true, 'returns expected value' ); + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'tickRound': true + }); + t.strictEqual( isBoolean( v.tickRound ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `tickRound` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickRound': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `tickRound` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js index e9b70065bc32..40d2e8382e2a 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -52,42 +51,11 @@ tape( 'the constructor returns an instance which has a `tickSize` property', fun 'orient': 'bottom', 'tickSize': 5 }); - t.strictEqual( isNumber( v.tickSize ), true, 'returns expected value' ); + t.strictEqual( isNonNegativeNumber( v.tickSize ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `tickSize` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -1, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickSize': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `tickSize` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js index 63b204e0487d..9e7b4c2b8b43 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -52,42 +51,11 @@ tape( 'the constructor returns an instance which has a `tickWidth` property', fu 'orient': 'bottom', 'tickWidth': 2 }); - t.strictEqual( isNumber( v.tickWidth ), true, 'returns expected value' ); + t.strictEqual( isNonNegativeNumber( v.tickWidth ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `tickWidth` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -1, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'tickWidth': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `tickWidth` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js index 88ac9b4a224f..dd5d561ea18c 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isBoolean = require( '@stdlib/assert/is-boolean' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,36 +47,6 @@ tape( 'the constructor returns an instance which has a `ticks` property', functi t.end(); }); -tape( 'the constructor throws an error if provided an invalid `ticks` option', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'ticks': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `ticks` property which throws an error if set to a non-boolean value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js index 367763bdc256..b58781cf71ff 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js @@ -26,7 +26,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isArray = require( '@stdlib/assert/is-array' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,37 +47,6 @@ tape( 'the constructor returns an instance which has a `title` property', functi t.end(); }); -tape( 'the constructor throws an error if provided an invalid `title` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'title': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `title` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js index 957209885899..72c0bd9f2d2b 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js @@ -24,9 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,40 +45,15 @@ tape( 'the constructor returns an instance which has a `titleAlign` property', f t.strictEqual( hasOwnProp( v, 'titleAlign' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'titleAlign' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.titleAlign ), true, 'returns expected value' ); + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAlign': 'center' + }); + t.strictEqual( isString( v.titleAlign ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titleAlign` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleAlign': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titleAlign` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js index 8dc57495ba84..dc3f386298dc 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isNull = require( '@stdlib/assert/is-null' ); +var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -43,39 +44,15 @@ tape( 'the constructor returns an instance which has a `titleAnchor` property', }); t.strictEqual( hasOwnProp( v, 'titleAnchor' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'titleAnchor' ), true, 'returns expected value' ); - t.strictEqual( v.titleAnchor, null, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor throws an error if provided an invalid `titleAnchor` option', function test( t ) { - var values; - var i; + t.strictEqual( isNull( v.titleAnchor ), true, 'returns expected value' ); - values = [ - 'beep', - 5, - NaN, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleAnchor': 'start' + }); + t.strictEqual( isString( v.titleAnchor ), true, 'returns expected value' ); t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleAnchor': value - }); - }; - } }); tape( 'the constructor returns an instance having a `titleAnchor` property which throws an error if set to an invalid value', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js index be43114bf07d..1da66aaa2361 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `titleAngle` property', f t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titleAngle` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleAngle': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titleAngle` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js index 8b3f090c2fd5..5a17e9202ee8 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js @@ -24,9 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,41 +45,15 @@ tape( 'the constructor returns an instance which has a `titleBaseline` property' t.strictEqual( hasOwnProp( v, 'titleBaseline' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'titleBaseline' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.titleBaseline ), true, 'returns expected value' ); + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleBaseline': 'top' + }); + t.strictEqual( isString( v.titleBaseline ), true, 'returns expected value' ); t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titleBaseline` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleBaseline': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titleBaseline` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js index 02e7afe3e661..4e7dd5937a09 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js @@ -27,7 +27,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,36 +56,6 @@ tape( 'the constructor returns an instance which has a `titleColor` property', f t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titleColor` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleColor': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titleColor` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js index 6456cbb42c80..fd281253db39 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js @@ -27,7 +27,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,36 +56,6 @@ tape( 'the constructor returns an instance which has a `titleFont` property', fu t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titleFont` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleFont': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titleFont` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js index 2f677878fd2f..487114ef9a05 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `titleFontSize` property' t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titleFontSize` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleFontSize': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titleFontSize` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js index 3116174048f5..1aabe86ce477 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js @@ -27,7 +27,6 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,36 +56,6 @@ tape( 'the constructor returns an instance which has a `titleFontStyle` property t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titleFontStyle` option', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleFontStyle': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titleFontStyle` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js index 3cbe8448b6e7..ddea70e7931a 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; +var isString = require( '@stdlib/assert/is-string' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,35 +46,21 @@ tape( 'the constructor returns an instance which has a `titleFontWeight` propert t.strictEqual( hasOwnProp( v, 'titleFontWeight' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'titleFontWeight' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.titleFontWeight ), true, 'returns expected value' ); - t.end(); -}); -tape( 'the constructor throws an error if provided an invalid `titleFontWeight` option', function test( t ) { - var values; - var i; + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontWeight': 'bold' + }); + t.strictEqual( isString( v.titleFontWeight ), true, 'returns expected value' ); - values = [ - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleFontWeight': 700 + }); + t.strictEqual( isNumber( v.titleFontWeight ), true, 'returns expected value' ); t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleFontWeight': value - }); - }; - } }); tape( 'the constructor returns an instance having a `titleFontWeight` property which throws an error if set to an invalid value', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js index 2022135c1e4e..250002d1518d 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js @@ -24,9 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); +var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -45,38 +45,14 @@ tape( 'the constructor returns an instance which has a `titleLimit` property', f t.strictEqual( hasOwnProp( v, 'titleLimit' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'titleLimit' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.titleLimit ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the constructor throws an error if provided an invalid `titleLimit` option', function test( t ) { - var values; - var i; - values = [ - 'beep', - -1, - NaN, - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } + v = new Axis({ + 'scale': 'xScale', + 'orient': 'bottom', + 'titleLimit': 120 + }); + t.strictEqual( isNonNegativeNumber( v.titleLimit ), true, 'returns expected value' ); t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleLimit': value - }); - }; - } }); tape( 'the constructor returns an instance having a `titleLimit` property which throws an error if set to an invalid value', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js index fda0ece34f2e..590dead4e722 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `titleLineHeight` propert t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titleLineHeight` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleLineHeight': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titleLineHeight` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js index 93bb96b7c869..d8f2a9787848 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js @@ -23,10 +23,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,35 +47,6 @@ tape( 'the constructor returns an instance which has a `titleOpacity` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titleOpacity` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - -0.1, - 1.1, - NaN, - void 0, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleOpacity': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titleOpacity` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js index 6b8dcede67e7..e725b0527bf0 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `titlePadding` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titlePadding` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titlePadding': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titlePadding` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js index eff472e89e12..72a9258edddb 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `titleX` property', funct t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titleX` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleX': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titleX` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js index 4617d685dfcd..f9e7a20af517 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js @@ -24,10 +24,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -57,35 +56,6 @@ tape( 'the constructor returns an instance which has a `titleY` property', funct t.end(); }); -tape( 'the constructor throws an error if provided an invalid `titleY` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'titleY': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `titleY` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js index 5542c7573f28..2e12a8916abc 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js @@ -23,10 +23,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,36 +47,6 @@ tape( 'the constructor returns an instance which has a `translate` property', fu t.end(); }); -tape( 'the constructor throws an error if provided an invalid `translate` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'translate': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `translate` property which throws an error if set to an invalid value', function test( t ) { var values; var i; diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js index 6e608ae39c52..36a0fc190292 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js @@ -23,10 +23,9 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isNumber = require( '@stdlib/assert/is-number' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); - // TESTS // tape( 'main export is a function', function test( t ) { @@ -48,36 +47,6 @@ tape( 'the constructor returns an instance which has a `zindex` property', funct t.end(); }); -tape( 'the constructor throws an error if provided an invalid `zindex` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - var axis = new Axis({ // eslint-disable-line no-unused-vars - 'scale': 'xScale', - 'orient': 'bottom', - 'zindex': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `zindex` property which throws an error if set to an invalid value', function test( t ) { var values; var i; From a0fe34f073844d7512971614e1740ddac9c84aa0 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 3 May 2026 04:34:17 -0700 Subject: [PATCH 09/12] style: address lint error Signed-off-by: Athan --- lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js index e365efbe1efc..851f9f2d1e9e 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isBoolean = require( '@stdlib/assert/is-boolean' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { From 73640cc0ff08e15d03c58b72f7a7455c6abfa576 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 3 May 2026 18:23:25 -0700 Subject: [PATCH 10/12] test: fix grammar in descriptions Signed-off-by: Athan --- .../@stdlib/plot/vega/axis/ctor/test/test.aria.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js index 851f9f2d1e9e..dd9c63da04eb 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js @@ -35,7 +35,7 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the constructor returns an instance which has a `aria` property', function test( t ) { +tape( 'the constructor returns an instance which has an `aria` property', function test( t ) { var v; v = new Axis({ @@ -48,7 +48,7 @@ tape( 'the constructor returns an instance which has a `aria` property', functio t.end(); }); -tape( 'the constructor returns an instance having a `aria` property which throws an error if set to a non-boolean value', function test( t ) { +tape( 'the constructor returns an instance having an `aria` property which throws an error if set to a non-boolean value', function test( t ) { var values; var i; @@ -78,7 +78,7 @@ tape( 'the constructor returns an instance having a `aria` property which throws } }); -tape( 'the constructor returns an instance having a `aria` property', function test( t ) { +tape( 'the constructor returns an instance having an `aria` property', function test( t ) { var axis; axis = new Axis({ @@ -104,7 +104,7 @@ tape( 'the constructor returns an instance having a `aria` property', function t t.end(); }); -tape( 'the constructor returns an instance having a `aria` property which can be set to a boolean', function test( t ) { +tape( 'the constructor returns an instance having an `aria` property which can be set to a boolean', function test( t ) { var axis; axis = new Axis({ From f8eeb153f918e96a38a20c560df435cba9b98729 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 3 May 2026 18:27:42 -0700 Subject: [PATCH 11/12] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js | 2 +- .../@stdlib/plot/vega/axis/ctor/test/test.band_position.js | 1 + .../@stdlib/plot/vega/axis/ctor/test/test.description.js | 3 ++- .../@stdlib/plot/vega/axis/ctor/test/test.domain.js | 3 ++- .../@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js | 3 ++- .../@stdlib/plot/vega/axis/ctor/test/test.domain_color.js | 3 ++- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js index dd9c63da04eb..4c988e0e021f 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.aria.js @@ -23,7 +23,7 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var Axis = require( './../lib' ); diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js index 1ef7120520b0..f05c91bd6082 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.band_position.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js index df21571d7737..83b589425fcb 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.description.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js index aa80459e183b..8c49e2c68e75 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js index 766af4f44a73..3dfea1a133ab 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_cap.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js index 0a1d1e655036..42f4997a15f2 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_color.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { From 0c054f93efdeb7727d56a451ce936ee879de1925 Mon Sep 17 00:00:00 2001 From: orthodox-64 Date: Tue, 5 May 2026 12:13:53 +0530 Subject: [PATCH 12/12] chore: suggested changes --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../plot/vega/axis/ctor/test/test.domain_dash.js | 3 ++- .../vega/axis/ctor/test/test.domain_dash_offset.js | 3 ++- .../plot/vega/axis/ctor/test/test.domain_opacity.js | 3 ++- .../plot/vega/axis/ctor/test/test.domain_width.js | 3 ++- .../@stdlib/plot/vega/axis/ctor/test/test.format.js | 5 +++-- .../plot/vega/axis/ctor/test/test.format_type.js | 5 +++-- .../@stdlib/plot/vega/axis/ctor/test/test.grid.js | 5 +++-- .../plot/vega/axis/ctor/test/test.grid_cap.js | 5 +++-- .../plot/vega/axis/ctor/test/test.grid_color.js | 5 +++-- .../plot/vega/axis/ctor/test/test.grid_dash.js | 3 ++- .../vega/axis/ctor/test/test.grid_dash_offset.js | 3 ++- .../plot/vega/axis/ctor/test/test.grid_opacity.js | 3 ++- .../plot/vega/axis/ctor/test/test.grid_scale.js | 5 +++-- .../plot/vega/axis/ctor/test/test.grid_width.js | 3 ++- .../plot/vega/axis/ctor/test/test.label_align.js | 5 +++-- .../plot/vega/axis/ctor/test/test.label_angle.js | 3 ++- .../plot/vega/axis/ctor/test/test.label_baseline.js | 5 +++-- .../plot/vega/axis/ctor/test/test.label_bound.js | 3 ++- .../plot/vega/axis/ctor/test/test.label_color.js | 5 +++-- .../plot/vega/axis/ctor/test/test.label_flush.js | 3 ++- .../vega/axis/ctor/test/test.label_flush_offset.js | 3 ++- .../plot/vega/axis/ctor/test/test.label_font.js | 5 +++-- .../vega/axis/ctor/test/test.label_font_size.js | 3 ++- .../vega/axis/ctor/test/test.label_font_style.js | 5 +++-- .../vega/axis/ctor/test/test.label_font_weight.js | 5 +++-- .../plot/vega/axis/ctor/test/test.label_limit.js | 3 ++- .../vega/axis/ctor/test/test.label_line_height.js | 3 ++- .../plot/vega/axis/ctor/test/test.label_offset.js | 3 ++- .../plot/vega/axis/ctor/test/test.label_opacity.js | 3 ++- .../plot/vega/axis/ctor/test/test.label_overlap.js | 5 +++-- .../plot/vega/axis/ctor/test/test.label_padding.js | 3 ++- .../vega/axis/ctor/test/test.label_separation.js | 3 ++- .../@stdlib/plot/vega/axis/ctor/test/test.labels.js | 5 +++-- .../plot/vega/axis/ctor/test/test.max_extent.js | 3 ++- .../plot/vega/axis/ctor/test/test.min_extent.js | 3 ++- .../@stdlib/plot/vega/axis/ctor/test/test.offset.js | 3 ++- .../@stdlib/plot/vega/axis/ctor/test/test.orient.js | 13 +++++++------ .../plot/vega/axis/ctor/test/test.position.js | 3 ++- .../@stdlib/plot/vega/axis/ctor/test/test.scale.js | 5 +++-- .../plot/vega/axis/ctor/test/test.tick_band.js | 5 +++-- .../plot/vega/axis/ctor/test/test.tick_cap.js | 5 +++-- .../plot/vega/axis/ctor/test/test.tick_color.js | 5 +++-- .../plot/vega/axis/ctor/test/test.tick_count.js | 9 ++++++--- .../plot/vega/axis/ctor/test/test.tick_dash.js | 3 ++- .../vega/axis/ctor/test/test.tick_dash_offset.js | 3 ++- .../plot/vega/axis/ctor/test/test.tick_extra.js | 3 ++- .../plot/vega/axis/ctor/test/test.tick_min_step.js | 3 ++- .../plot/vega/axis/ctor/test/test.tick_offset.js | 3 ++- .../plot/vega/axis/ctor/test/test.tick_round.js | 3 ++- .../plot/vega/axis/ctor/test/test.tick_size.js | 3 ++- .../plot/vega/axis/ctor/test/test.tick_width.js | 3 ++- .../@stdlib/plot/vega/axis/ctor/test/test.ticks.js | 5 +++-- .../@stdlib/plot/vega/axis/ctor/test/test.title.js | 3 ++- .../plot/vega/axis/ctor/test/test.title_align.js | 5 +++-- .../plot/vega/axis/ctor/test/test.title_anchor.js | 5 +++-- .../plot/vega/axis/ctor/test/test.title_angle.js | 3 ++- .../plot/vega/axis/ctor/test/test.title_baseline.js | 5 +++-- .../plot/vega/axis/ctor/test/test.title_color.js | 5 +++-- .../plot/vega/axis/ctor/test/test.title_font.js | 5 +++-- .../vega/axis/ctor/test/test.title_font_size.js | 3 ++- .../vega/axis/ctor/test/test.title_font_style.js | 5 +++-- .../vega/axis/ctor/test/test.title_font_weight.js | 5 +++-- .../plot/vega/axis/ctor/test/test.title_limit.js | 3 ++- .../vega/axis/ctor/test/test.title_line_height.js | 3 ++- .../plot/vega/axis/ctor/test/test.title_opacity.js | 3 ++- .../plot/vega/axis/ctor/test/test.title_padding.js | 3 ++- .../plot/vega/axis/ctor/test/test.title_x.js | 3 ++- .../plot/vega/axis/ctor/test/test.title_y.js | 3 ++- .../plot/vega/axis/ctor/test/test.translate.js | 3 ++- .../@stdlib/plot/vega/axis/ctor/test/test.zindex.js | 3 ++- 70 files changed, 175 insertions(+), 103 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js index f049a45e0e47..1d0f99cb9d81 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isArray = require( '@stdlib/assert/is-array' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -115,8 +116,8 @@ tape( 'the constructor returns an instance having a `domainDash` property which }); tape( 'the constructor returns an instance which emits an event when the `domainDash` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js index ba6d697141bf..5b02b7f03afc 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_dash_offset.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `domainDashOffset` property }); tape( 'the constructor returns an instance which emits an event when the `domainDashOffset` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js index fe892f25031a..062d540480d6 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_opacity.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -116,8 +117,8 @@ tape( 'the constructor returns an instance having a `domainOpacity` property whi }); tape( 'the constructor returns an instance which emits an event when the `domainOpacity` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js index 99dd91e12030..a07961b4de7c 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.domain_width.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -124,8 +125,8 @@ tape( 'the constructor returns an instance having a `domainWidth` property which }); tape( 'the constructor returns an instance which emits an event when the `domainWidth` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js index d59b9f1d6ab7..fb0524493b90 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -120,8 +121,8 @@ tape( 'the constructor returns an instance having a `format` property which can }); tape( 'the constructor returns an instance which emits an event when the `format` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js index d37e29948f20..076c0335a66c 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.format_type.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -125,8 +126,8 @@ tape( 'the constructor returns an instance having a `formatType` property which }); tape( 'the constructor returns an instance which emits an event when the `formatType` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js index 50b5d00583a1..63b95df7cd6f 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -114,8 +115,8 @@ tape( 'the constructor returns an instance having a `grid` property which can be }); tape( 'the constructor returns an instance which emits an event when the `grid` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js index 4e0bdb2b97c8..a2cec6bda05a 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_cap.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -127,8 +128,8 @@ tape( 'the constructor returns an instance having a `gridCap` property which can }); tape( 'the constructor returns an instance which emits an event when the `gridCap` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js index 1727c882c051..9ed300dc67a9 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_color.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `gridColor` property which c }); tape( 'the constructor returns an instance which emits an event when the `gridColor` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js index 59156d314865..dbfb5b361c9e 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isArray = require( '@stdlib/assert/is-array' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -115,8 +116,8 @@ tape( 'the constructor returns an instance having a `gridDash` property which ca }); tape( 'the constructor returns an instance which emits an event when the `gridDash` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js index d0dca20b500a..b61ed0ae3cc2 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_dash_offset.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `gridDashOffset` property wh }); tape( 'the constructor returns an instance which emits an event when the `gridDashOffset` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js index a23daa38deb7..5692c66ee7a3 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_opacity.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -120,8 +121,8 @@ tape( 'the constructor returns an instance having a `gridOpacity` property which }); tape( 'the constructor returns an instance which emits an event when the `gridOpacity` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js index 0c4e5359ea5c..fca908dd8d2b 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_scale.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `gridScale` property which c }); tape( 'the constructor returns an instance which emits an event when the `gridScale` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js index 4dd996416e5a..4d8eafb76c89 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.grid_width.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -124,8 +125,8 @@ tape( 'the constructor returns an instance having a `gridWidth` property which c }); tape( 'the constructor returns an instance which emits an event when the `gridWidth` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js index 1f945478f5c4..9934e45a2939 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_align.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `labelAlign` property which }); tape( 'the constructor returns an instance which emits an event when the `labelAlign` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js index aae5cade7c92..4f6cf3b7dabe 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_angle.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `labelAngle` property which }); tape( 'the constructor returns an instance which emits an event when the `labelAngle` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js index fa570bf8954e..a208593ce86e 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_baseline.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -126,8 +127,8 @@ tape( 'the constructor returns an instance having a `labelBaseline` property whi }); tape( 'the constructor returns an instance which emits an event when the `labelBaseline` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js index b94ae5fe7ae5..39f92f1bd5f1 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_bound.js @@ -25,6 +25,7 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -120,8 +121,8 @@ tape( 'the constructor returns an instance having a `labelBound` property which }); tape( 'the constructor returns an instance which emits an event when the `labelBound` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js index 3e866e79e729..761f30acf34e 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_color.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `labelColor` property which }); tape( 'the constructor returns an instance which emits an event when the `labelColor` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js index 38dc077868f4..c10aabaeec49 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush.js @@ -28,6 +28,7 @@ var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -137,8 +138,8 @@ tape( 'the constructor returns an instance having a `labelFlush` property which }); tape( 'the constructor returns an instance which emits an event when the `labelFlush` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js index e1bd886fa6ca..4598224f4d58 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_flush_offset.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -114,8 +115,8 @@ tape( 'the constructor returns an instance having a `labelFlushOffset` property }); tape( 'the constructor returns an instance which emits an event when the `labelFlushOffset` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js index 9033ad785fc6..a4455cdf73cb 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `labelFont` property which c }); tape( 'the constructor returns an instance which emits an event when the `labelFont` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js index 88911ea28970..284e8ce65a67 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_size.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `labelFontSize` property whi }); tape( 'the constructor returns an instance which emits an event when the `labelFontSize` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js index 08d98f26f853..35d6f65f352b 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_style.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `labelFontStyle` property wh }); tape( 'the constructor returns an instance which emits an event when the `labelFontStyle` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js index e3154dee6f3d..32c7ece16679 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_font_weight.js @@ -25,9 +25,10 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -138,8 +139,8 @@ tape( 'the constructor returns an instance having a `labelFontWeight` property w }); tape( 'the constructor returns an instance which emits an event when the `labelFontWeight` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js index 0657151e733d..b3ff3de150e5 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_limit.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `labelLimit` property which }); tape( 'the constructor returns an instance which emits an event when the `labelLimit` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js index 2d39a1a3b3b4..cd8bf6490016 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_line_height.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `labelLineHeight` property w }); tape( 'the constructor returns an instance which emits an event when the `labelLineHeight` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js index d6e0aac854e0..59f582757e24 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_offset.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `labelOffset` property which }); tape( 'the constructor returns an instance which emits an event when the `labelOffset` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js index dace2affcea0..a95f2f1718b8 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_opacity.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -120,8 +121,8 @@ tape( 'the constructor returns an instance having a `labelOpacity` property whic }); tape( 'the constructor returns an instance which emits an event when the `labelOpacity` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js index 5a2da435e111..de7fd378fe2a 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_overlap.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -142,8 +143,8 @@ tape( 'the constructor returns an instance having a `labelOverlap` property whic }); tape( 'the constructor returns an instance which emits an event when the `labelOverlap` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js index 3bfb175662ba..9ab7f86fb7bf 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_padding.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `labelPadding` property whic }); tape( 'the constructor returns an instance which emits an event when the `labelPadding` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js index f05bae7d9f82..d326edfc60ab 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.label_separation.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -116,8 +117,8 @@ tape( 'the constructor returns an instance having a `labelSeparation` property w }); tape( 'the constructor returns an instance which emits an event when the `labelSeparation` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js index 7216f5120d06..2e0654895686 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.labels.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -114,8 +115,8 @@ tape( 'the constructor returns an instance having a `labels` property which can }); tape( 'the constructor returns an instance which emits an event when the `labels` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js index fac98a412476..3637b58358a6 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.max_extent.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -124,8 +125,8 @@ tape( 'the constructor returns an instance having a `maxExtent` property which c }); tape( 'the constructor returns an instance which emits an event when the `maxExtent` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js index a1508c876808..c1262a680b7b 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.min_extent.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -124,8 +125,8 @@ tape( 'the constructor returns an instance having a `minExtent` property which c }); tape( 'the constructor returns an instance which emits an event when the `minExtent` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js index 368fbfae1f2c..96564bcf618f 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.offset.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having an `offset` property which can }); tape( 'the constructor returns an instance which emits an event when the `offset` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js index 1b39a23f24d3..98352a0ab61d 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.orient.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -34,7 +35,7 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the constructor returns an instance which has a `orient` property', function test( t ) { +tape( 'the constructor returns an instance which has an `orient` property', function test( t ) { var v; v = new Axis({ @@ -47,7 +48,7 @@ tape( 'the constructor returns an instance which has a `orient` property', funct t.end(); }); -tape( 'the constructor returns an instance having a `orient` property which throws an error if set to an invalid value', function test( t ) { +tape( 'the constructor returns an instance having an `orient` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -81,7 +82,7 @@ tape( 'the constructor returns an instance having a `orient` property which thro } }); -tape( 'the constructor returns an instance having a `orient` property', function test( t ) { +tape( 'the constructor returns an instance having an `orient` property', function test( t ) { var axis; axis = new Axis({ @@ -111,7 +112,7 @@ tape( 'the constructor returns an instance having a `orient` property', function t.end(); }); -tape( 'the constructor returns an instance having a `orient` property which can be set to a valid orientation', function test( t ) { +tape( 'the constructor returns an instance having an `orient` property which can be set to a valid orientation', function test( t ) { var axis; axis = new Axis({ @@ -135,8 +136,8 @@ tape( 'the constructor returns an instance having a `orient` property which can }); tape( 'the constructor returns an instance which emits an event when the `orient` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js index 85992fbb2071..f5c293024f74 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.position.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -114,8 +115,8 @@ tape( 'the constructor returns an instance having a `position` property which ca }); tape( 'the constructor returns an instance which emits an event when the `position` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js index b5a12a3f8835..89538274282d 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.scale.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -114,8 +115,8 @@ tape( 'the constructor returns an instance having a `scale` property which can b }); tape( 'the constructor returns an instance which emits an event when the `scale` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js index f71ca54dea94..39a5dc09414e 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_band.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -130,8 +131,8 @@ tape( 'the constructor returns an instance having a `tickBand` property which ca }); tape( 'the constructor returns an instance which emits an event when the `tickBand` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js index c28856f66583..f13f339d9a7f 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_cap.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -127,8 +128,8 @@ tape( 'the constructor returns an instance having a `tickCap` property which can }); tape( 'the constructor returns an instance which emits an event when the `tickCap` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js index dd329e364ed6..5c05a8573614 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_color.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `tickColor` property which c }); tape( 'the constructor returns an instance which emits an event when the `tickColor` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js index bcce4b21d0de..942c8725199a 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_count.js @@ -24,11 +24,12 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var isObject = require( '@stdlib/assert/is-object' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -65,7 +66,9 @@ tape( 'the constructor returns an instance which has a `tickCount` property', fu v = new Axis({ 'scale': 'xScale', 'orient': 'bottom', - 'tickCount': { 'interval': 'Month' } + 'tickCount': { + 'interval': 'Month' + } }); t.strictEqual( isObject( v.tickCount ), true, 'returns expected value' ); t.end(); @@ -142,8 +145,8 @@ tape( 'the constructor returns an instance having a `tickCount` property which c }); tape( 'the constructor returns an instance which emits an event when the `tickCount` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js index 353edab3dcc7..b49628ed801b 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isArray = require( '@stdlib/assert/is-array' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -115,8 +116,8 @@ tape( 'the constructor returns an instance having a `tickDash` property which ca }); tape( 'the constructor returns an instance which emits an event when the `tickDash` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js index cc7d3d64281c..e03933e32f17 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_dash_offset.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `tickDashOffset` property wh }); tape( 'the constructor returns an instance which emits an event when the `tickDashOffset` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js index fa2bd6cfa559..c2030cd7e881 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_extra.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -128,8 +129,8 @@ tape( 'the constructor returns an instance having a `tickExtra` property which c }); tape( 'the constructor returns an instance which emits an event when the `tickExtra` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js index 2197bbcc15a1..f91f912d1fcc 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_min_step.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `tickMinStep` property which }); tape( 'the constructor returns an instance which emits an event when the `tickMinStep` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js index 36748f2eda72..99e152b268ce 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_offset.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `tickOffset` property which }); tape( 'the constructor returns an instance which emits an event when the `tickOffset` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js index 53489e5b26ed..d3a97db122de 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_round.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -127,8 +128,8 @@ tape( 'the constructor returns an instance having a `tickRound` property which c }); tape( 'the constructor returns an instance which emits an event when the `tickRound` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js index 40d2e8382e2a..47c89102d370 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_size.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -124,8 +125,8 @@ tape( 'the constructor returns an instance having a `tickSize` property which ca }); tape( 'the constructor returns an instance which emits an event when the `tickSize` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js index 9e7b4c2b8b43..f009db3a4620 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.tick_width.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -124,8 +125,8 @@ tape( 'the constructor returns an instance having a `tickWidth` property which c }); tape( 'the constructor returns an instance which emits an event when the `tickWidth` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js index dd5d561ea18c..b451f53140cf 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.ticks.js @@ -23,9 +23,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -114,8 +115,8 @@ tape( 'the constructor returns an instance having a `ticks` property which can b }); tape( 'the constructor returns an instance which emits an event when the `ticks` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js index b58781cf71ff..23760689260e 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isArray = require( '@stdlib/assert/is-array' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `title` property which can b }); tape( 'the constructor returns an instance which emits an event when the `title` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js index 72c0bd9f2d2b..2221ea50bcb9 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_align.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -125,8 +126,8 @@ tape( 'the constructor returns an instance having a `titleAlign` property which }); tape( 'the constructor returns an instance which emits an event when the `titleAlign` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js index dc3f386298dc..cad144f5cebd 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_anchor.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var hasProp = require( '@stdlib/assert/has-property' ); var isNull = require( '@stdlib/assert/is-null' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -126,8 +127,8 @@ tape( 'the constructor returns an instance having a `titleAnchor` property which }); tape( 'the constructor returns an instance which emits an event when the `titleAnchor` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js index 1da66aaa2361..af825c7a43ff 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_angle.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `titleAngle` property which }); tape( 'the constructor returns an instance which emits an event when the `titleAngle` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js index 5a17e9202ee8..ee948b50dac4 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_baseline.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -126,8 +127,8 @@ tape( 'the constructor returns an instance having a `titleBaseline` property whi }); tape( 'the constructor returns an instance which emits an event when the `titleBaseline` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js index 4e7dd5937a09..d397fbc05e2c 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_color.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `titleColor` property which }); tape( 'the constructor returns an instance which emits an event when the `titleColor` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js index fd281253db39..a3cdfb1f7ede 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `titleFont` property which c }); tape( 'the constructor returns an instance which emits an event when the `titleFont` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js index 487114ef9a05..de6180cd0d2f 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_size.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `titleFontSize` property whi }); tape( 'the constructor returns an instance which emits an event when the `titleFontSize` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js index 1aabe86ce477..953e862888a6 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_style.js @@ -24,9 +24,10 @@ var tape = require( 'tape' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `titleFontStyle` property wh }); tape( 'the constructor returns an instance which emits an event when the `titleFontStyle` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js index ddea70e7931a..087a63429d1c 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_font_weight.js @@ -25,9 +25,10 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isUndefined = require( '@stdlib/assert/is-undefined' ); var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -138,8 +139,8 @@ tape( 'the constructor returns an instance having a `titleFontWeight` property w }); tape( 'the constructor returns an instance which emits an event when the `titleFontWeight` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js index 250002d1518d..a3f41fb13705 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_limit.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNonNegativeNumber = require( '@stdlib/assert/is-nonnegative-number' ); var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -123,8 +124,8 @@ tape( 'the constructor returns an instance having a `titleLimit` property which }); tape( 'the constructor returns an instance which emits an event when the `titleLimit` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js index 590dead4e722..67a3c623df99 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_line_height.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `titleLineHeight` property w }); tape( 'the constructor returns an instance which emits an event when the `titleLineHeight` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js index d8f2a9787848..6a15264ec374 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_opacity.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -116,8 +117,8 @@ tape( 'the constructor returns an instance having a `titleOpacity` property whic }); tape( 'the constructor returns an instance which emits an event when the `titleOpacity` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js index e725b0527bf0..1e64b7593e31 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_padding.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `titlePadding` property whic }); tape( 'the constructor returns an instance which emits an event when the `titlePadding` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js index 72a9258edddb..e9b93ef6794f 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_x.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `titleX` property which can }); tape( 'the constructor returns an instance which emits an event when the `titleX` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js index f9e7a20af517..c9f26efbc18c 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.title_y.js @@ -27,6 +27,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -122,8 +123,8 @@ tape( 'the constructor returns an instance having a `titleY` property which can }); tape( 'the constructor returns an instance which emits an event when the `titleY` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js index 2e12a8916abc..a99e48c590a2 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.translate.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -114,8 +115,8 @@ tape( 'the constructor returns an instance having a `translate` property which c }); tape( 'the constructor returns an instance which emits an event when the `translate` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale', diff --git a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js index 36a0fc190292..a00419798ad9 100644 --- a/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js +++ b/lib/node_modules/@stdlib/plot/vega/axis/ctor/test/test.zindex.js @@ -26,6 +26,7 @@ var hasProp = require( '@stdlib/assert/has-property' ); var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Axis = require( './../lib' ); + // TESTS // tape( 'main export is a function', function test( t ) { @@ -114,8 +115,8 @@ tape( 'the constructor returns an instance having a `zindex` property which can }); tape( 'the constructor returns an instance which emits an event when the `zindex` property is set to a new value', function test( t ) { - var axis; var count; + var axis; axis = new Axis({ 'scale': 'xScale',