From 0a52ac6c53474ad065a869aae34db89c45c07189 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Sun, 1 Feb 2026 14:11:30 +0530 Subject: [PATCH 1/3] test: add tests for Title constructor and properties --- 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: passed - 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 --- --- .../@stdlib/plot/vega/title/ctor/lib/main.js | 2 +- .../plot/vega/title/ctor/test/test.align.js | 167 ++++++++++++ .../plot/vega/title/ctor/test/test.anchor.js | 167 ++++++++++++ .../plot/vega/title/ctor/test/test.angle.js | 167 ++++++++++++ .../plot/vega/title/ctor/test/test.aria.js | 160 +++++++++++ .../vega/title/ctor/test/test.baseline.js | 167 ++++++++++++ .../plot/vega/title/ctor/test/test.color.js | 167 ++++++++++++ .../plot/vega/title/ctor/test/test.dx.js | 167 ++++++++++++ .../plot/vega/title/ctor/test/test.dy.js | 167 ++++++++++++ .../plot/vega/title/ctor/test/test.encode.js | 230 ++++++++++++++++ .../plot/vega/title/ctor/test/test.font.js | 167 ++++++++++++ .../vega/title/ctor/test/test.font_size.js | 167 ++++++++++++ .../vega/title/ctor/test/test.font_style.js | 167 ++++++++++++ .../vega/title/ctor/test/test.font_weight.js | 185 +++++++++++++ .../plot/vega/title/ctor/test/test.frame.js | 162 +++++++++++ .../@stdlib/plot/vega/title/ctor/test/test.js | 252 ++++++++++++++++++ .../plot/vega/title/ctor/test/test.limit.js | 167 ++++++++++++ .../vega/title/ctor/test/test.line_height.js | 167 ++++++++++++ .../plot/vega/title/ctor/test/test.offset.js | 167 ++++++++++++ .../plot/vega/title/ctor/test/test.orient.js | 178 +++++++++++++ .../vega/title/ctor/test/test.properties.js | 77 ++++++ .../vega/title/ctor/test/test.subtitle.js | 167 ++++++++++++ .../title/ctor/test/test.subtitle_color.js | 167 ++++++++++++ .../title/ctor/test/test.subtitle_font.js | 167 ++++++++++++ .../ctor/test/test.subtitle_font_size.js | 167 ++++++++++++ .../ctor/test/test.subtitle_font_style.js | 167 ++++++++++++ .../ctor/test/test.subtitle_font_weight.js | 185 +++++++++++++ .../ctor/test/test.subtitle_line_height.js | 167 ++++++++++++ .../title/ctor/test/test.subtitle_padding.js | 167 ++++++++++++ .../plot/vega/title/ctor/test/test.text.js | 165 ++++++++++++ .../plot/vega/title/ctor/test/test.zindex.js | 161 +++++++++++ 31 files changed, 5096 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.align.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.anchor.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.angle.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.aria.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.baseline.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.color.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dx.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dy.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.encode.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_size.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_style.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_weight.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.frame.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.limit.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.line_height.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.offset.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.orient.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.properties.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_color.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_size.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_style.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_weight.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_line_height.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_padding.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.text.js create mode 100644 lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.zindex.js diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js index 9a9fdfe5c464..17a4bb3d7c37 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js @@ -396,7 +396,7 @@ setReadWriteAccessor( Title.prototype, 'font', getFont, setFont ); * * @name fontSize * @memberof Title.prototype -* @type {(string|void)} +* @type {(number|void)} * * @example * var title = new Title({ diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.align.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.align.js new file mode 100644 index 000000000000..095b147f4578 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.align.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `align` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'align' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'align' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.align ), true, 'returns expected value' ); + + v = new Title({ + 'align': 'left' + }); + t.strictEqual( isString( v.align ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `align` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'align': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `align` 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 title = new Title(); + title.align = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `align` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.align ), true, 'returns expected value' ); + + title = new Title({ + 'align': 'left' + }); + t.strictEqual( title.align, 'left', 'returns expected value' ); + + title = new Title({ + 'align': 'top' + }); + t.strictEqual( title.align, 'top', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `align` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.align = 'left'; + t.strictEqual( title.align, 'left', 'returns expected value' ); + + title.align = 'top'; + t.strictEqual( title.align, 'top', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `align` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.align = 'left'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.align = 'top'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.align = 'top'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.anchor.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.anchor.js new file mode 100644 index 000000000000..01ee3dfd905e --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.anchor.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `anchor` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'anchor' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'anchor' ), true, 'returns expected value' ); + t.strictEqual( isString( v.anchor ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `anchor` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'START', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'anchor': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `anchor` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'START', + 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 title = new Title(); + title.anchor = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `anchor` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( title.anchor, 'middle', 'returns expected value' ); + + title = new Title({ + 'anchor': 'start' + }); + t.strictEqual( title.anchor, 'start', 'returns expected value' ); + + title = new Title({ + 'anchor': 'end' + }); + t.strictEqual( title.anchor, 'end', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `anchor` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.anchor = 'start'; + t.strictEqual( title.anchor, 'start', 'returns expected value' ); + + title.anchor = 'end'; + t.strictEqual( title.anchor, 'end', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `anchor` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.anchor = 'start'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.anchor = 'end'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.anchor = 'end'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.angle.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.angle.js new file mode 100644 index 000000000000..96097ddfc3ee --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.angle.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `angle` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'angle' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'angle' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.angle ), true, 'returns expected value' ); + + v = new Title({ + 'angle': 90 + }); + t.strictEqual( isNumber( v.angle ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `angle` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'angle': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `angle` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title(); + title.angle = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `angle` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.angle ), true, 'returns expected value' ); + + title = new Title({ + 'angle': 90 + }); + t.strictEqual( title.angle, 90, 'returns expected value' ); + + title = new Title({ + 'angle': 180 + }); + t.strictEqual( title.angle, 180, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `angle` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.angle = 90; + t.strictEqual( title.angle, 90, 'returns expected value' ); + + title.angle = 180; + t.strictEqual( title.angle, 180, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `angle` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.angle = 90; + t.strictEqual( count, 1, 'returns expected value' ); + + title.angle = 180; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.angle = 180; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.aria.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.aria.js new file mode 100644 index 000000000000..b4496bca501d --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.aria.js @@ -0,0 +1,160 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, '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 Title(); + 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 title = new Title({ // eslint-disable-line no-unused-vars + '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 title = new Title(); + title.aria = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `aria` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( title.aria, true, 'returns expected value' ); + + title = new Title({ + 'aria': false + }); + t.strictEqual( title.aria, false, 'returns expected value' ); + + title = new Title({ + 'aria': true + }); + t.strictEqual( title.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 title; + + title = new Title(); + + title.aria = true; + t.strictEqual( title.aria, true, 'returns expected value' ); + + title.aria = false; + t.strictEqual( title.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 title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.aria = false; + t.strictEqual( count, 1, 'returns expected value' ); + + title.aria = true; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.aria = true; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.baseline.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.baseline.js new file mode 100644 index 000000000000..a37803d3bae3 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.baseline.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `baseline` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'baseline' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'baseline' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.baseline ), true, 'returns expected value' ); + + v = new Title({ + 'baseline': 'top' + }); + t.strictEqual( isString( v.baseline ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `baseline` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'baseline': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `baseline` 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 title = new Title(); + title.baseline = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `baseline` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.baseline ), true, 'returns expected value' ); + + title = new Title({ + 'baseline': 'top' + }); + t.strictEqual( title.baseline, 'top', 'returns expected value' ); + + title = new Title({ + 'baseline': 'bottom' + }); + t.strictEqual( title.baseline, 'bottom', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `baseline` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.baseline = 'top'; + t.strictEqual( title.baseline, 'top', 'returns expected value' ); + + title.baseline = 'bottom'; + t.strictEqual( title.baseline, 'bottom', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `baseline` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.baseline = 'bottom'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.baseline = 'top'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.baseline = 'top'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.color.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.color.js new file mode 100644 index 000000000000..5d2d5abd4438 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.color.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `color` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'color' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'color' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.color ), true, 'returns expected value' ); + + v = new Title({ + 'color': 'red' + }); + t.strictEqual( isString( v.color ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `color` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'color': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `color` 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 title = new Title(); + title.color = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `color` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.color ), true, 'returns expected value' ); + + title = new Title({ + 'color': 'steelblue' + }); + t.strictEqual( title.color, 'steelblue', 'returns expected value' ); + + title = new Title({ + 'color': 'red' + }); + t.strictEqual( title.color, 'red', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `color` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.color = 'steelblue'; + t.strictEqual( title.color, 'steelblue', 'returns expected value' ); + + title.color = 'red'; + t.strictEqual( title.color, 'red', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `color` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.color = 'red'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.color = 'steelblue'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.color = 'steelblue'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dx.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dx.js new file mode 100644 index 000000000000..16a6d4bef6e8 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dx.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `dx` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'dx' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'dx' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.dx ), true, 'returns expected value' ); + + v = new Title({ + 'dx': 2 + }); + t.strictEqual( isNumber( v.dx ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `dx` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'dx': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `dx` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title(); + title.dx = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `dx` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.dx ), true, 'returns expected value' ); + + title = new Title({ + 'dx': 2 + }); + t.strictEqual( title.dx, 2, 'returns expected value' ); + + title = new Title({ + 'dx': 4 + }); + t.strictEqual( title.dx, 4, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `dx` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.dx = 2; + t.strictEqual( title.dx, 2, 'returns expected value' ); + + title.dx = 4; + t.strictEqual( title.dx, 4, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `dx` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.dx = 2; + t.strictEqual( count, 1, 'returns expected value' ); + + title.dx = 4; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.dx = 4; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dy.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dy.js new file mode 100644 index 000000000000..40905c38aaf2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dy.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `dy` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'dy' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'dy' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.dy ), true, 'returns expected value' ); + + v = new Title({ + 'dy': 2 + }); + t.strictEqual( isNumber( v.dy ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `dy` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'dy': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `dy` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title(); + title.dy = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `dy` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.dy ), true, 'returns expected value' ); + + title = new Title({ + 'dy': 2 + }); + t.strictEqual( title.dy, 2, 'returns expected value' ); + + title = new Title({ + 'dy': 4 + }); + t.strictEqual( title.dy, 4, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `dy` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.dy = 2; + t.strictEqual( title.dy, 2, 'returns expected value' ); + + title.dy = 4; + t.strictEqual( title.dy, 4, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `dy` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.dy = 2; + t.strictEqual( count, 1, 'returns expected value' ); + + title.dy = 4; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.dy = 4; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.encode.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.encode.js new file mode 100644 index 000000000000..03f84d0a9140 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.encode.js @@ -0,0 +1,230 @@ +/** +* @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 isObject = require( '@stdlib/assert/is-object' ); +var Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `encode` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'encode' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'encode' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.encode ), true, 'returns expected value' ); + + v = new Title({ + 'encode': { + 'title': { + 'enter': { + 'fill': { + 'value': 'steelblue' + } + } + } + } + }); + t.strictEqual( isObject( v.encode ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `encode` option', function test( t ) { + var values; + var i; + + values = [ + 5, + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'encode': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `encode` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 5, + 'beep', + 'boop', + 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 title = new Title(); + title.encode = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `encode` property', function test( t ) { + var expected; + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.encode ), true, 'returns expected value' ); + + title = new Title({ + 'encode': { + 'title': { + 'enter': { + 'fill': { + 'value': 'steelblue' + } + } + } + } + }); + + expected = { + 'encode': { + 'title': { + 'enter': { + 'fill': { + 'value': 'steelblue' + } + } + } + } + }; + t.deepEqual( title.encode, expected.encode, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor returns an instance having a `encode` property which can be set to a valid method', function test( t ) { + var expected; + var title; + + title = new Title(); + + title.encode = { + 'title': { + 'enter': { + 'fill': { + 'value': 'steelblue' + } + } + } + }; + + expected = { + 'encode': { + 'title': { + 'enter': { + 'fill': { + 'value': 'steelblue' + } + } + } + } + }; + t.deepEqual( title.encode, expected.encode, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `encode` property is set to a new value', function test( t ) { + var title; + var count; + var obj1; + var obj2; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + obj1 = { + 'title': { + 'enter': { + 'fill': { + 'value': 'steelblue' + } + } + } + }; + title.encode = obj1; + t.strictEqual( count, 1, 'returns expected value' ); + + obj2 = { + 'title': { + 'enter': { + 'fill': { + 'value': 'red' + } + } + } + }; + title.encode = obj2; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.encode = obj2; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font.js new file mode 100644 index 000000000000..dffc122db8bb --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `font` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'font' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'font' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.font ), true, 'returns expected value' ); + + v = new Title({ + 'font': 'Arial' + }); + t.strictEqual( isString( v.font ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `font` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'font': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `font` 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 title = new Title(); + title.font = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `font` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.font ), true, 'returns expected value' ); + + title = new Title({ + 'font': 'Arial' + }); + t.strictEqual( title.font, 'Arial', 'returns expected value' ); + + title = new Title({ + 'font': 'Sans' + }); + t.strictEqual( title.font, 'Sans', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `font` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.font = 'Arial'; + t.strictEqual( title.font, 'Arial', 'returns expected value' ); + + title.font = 'Sans'; + t.strictEqual( title.font, 'Sans', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `font` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.font = 'Sans'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.font = 'Arial'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.font = 'Arial'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_size.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_size.js new file mode 100644 index 000000000000..a41c8dd5bdf7 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_size.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `fontSize` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'fontSize' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'fontSize' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.fontSize ), true, 'returns expected value' ); + + v = new Title({ + 'fontSize': 12 + }); + t.strictEqual( isNumber( v.fontSize ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `fontSize` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'fontSize': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `fontSize` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title(); + title.fontSize = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `fontSize` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.fontSize ), true, 'returns expected value' ); + + title = new Title({ + 'fontSize': 12 + }); + t.strictEqual( title.fontSize, 12, 'returns expected value' ); + + title = new Title({ + 'fontSize': 14 + }); + t.strictEqual( title.fontSize, 14, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `fontSize` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.fontSize = 12; + t.strictEqual( title.fontSize, 12, 'returns expected value' ); + + title.fontSize = 14; + t.strictEqual( title.fontSize, 14, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `fontSize` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.fontSize = 12; + t.strictEqual( count, 1, 'returns expected value' ); + + title.fontSize = 14; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.fontSize = 14; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_style.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_style.js new file mode 100644 index 000000000000..18cb1c19f096 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_style.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `fontStyle` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'fontStyle' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'fontStyle' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.fontStyle ), true, 'returns expected value' ); + + v = new Title({ + 'fontStyle': 'Arial' + }); + t.strictEqual( isString( v.fontStyle ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `fontStyle` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'fontStyle': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `fontStyle` 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 title = new Title(); + title.fontStyle = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `fontStyle` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.fontStyle ), true, 'returns expected value' ); + + title = new Title({ + 'fontStyle': 'Arial' + }); + t.strictEqual( title.fontStyle, 'Arial', 'returns expected value' ); + + title = new Title({ + 'fontStyle': 'Sans' + }); + t.strictEqual( title.fontStyle, 'Sans', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `fontStyle` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.fontStyle = 'Arial'; + t.strictEqual( title.fontStyle, 'Arial', 'returns expected value' ); + + title.fontStyle = 'Sans'; + t.strictEqual( title.fontStyle, 'Sans', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `fontStyle` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.fontStyle = 'Sans'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.fontStyle = 'Arial'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.fontStyle = 'Arial'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_weight.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_weight.js new file mode 100644 index 000000000000..94657b56f117 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_weight.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 isString = require( '@stdlib/assert/is-string' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `fontWeight` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'fontWeight' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'fontWeight' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.fontWeight ), true, 'returns expected value' ); + + v = new Title({ + 'fontWeight': 'bold' + }); + t.strictEqual( isString( v.fontWeight ), true, 'returns expected value' ); + + v = new Title({ + 'fontWeight': 6 + }); + t.strictEqual( isNumber( v.fontWeight ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `fontWeight` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'fontWeight': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `fontWeight` 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 title = new Title(); + title.fontWeight = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `fontWeight` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.fontWeight ), true, 'returns expected value' ); + + title = new Title({ + 'fontWeight': 'bold' + }); + t.strictEqual( title.fontWeight, 'bold', 'returns expected value' ); + + title = new Title({ + 'fontWeight': 'light' + }); + t.strictEqual( title.fontWeight, 'light', 'returns expected value' ); + + title = new Title({ + 'fontWeight': 6 + }); + t.strictEqual( title.fontWeight, 6, 'returns expected value' ); + + title = new Title({ + 'fontWeight': 8 + }); + t.strictEqual( title.fontWeight, 8, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `fontWeight` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.fontWeight = 'bold'; + t.strictEqual( title.fontWeight, 'bold', 'returns expected value' ); + + title.fontWeight = 'light'; + t.strictEqual( title.fontWeight, 'light', 'returns expected value' ); + + title.fontWeight = 6; + t.strictEqual( title.fontWeight, 6, 'returns expected value' ); + + title.fontWeight = 8; + t.strictEqual( title.fontWeight, 8, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `fontWeight` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.fontWeight = 'light'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.fontWeight = 'bold'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.fontWeight = 'bold'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.frame.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.frame.js new file mode 100644 index 000000000000..0e5570717866 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.frame.js @@ -0,0 +1,162 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `frame` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'frame' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'frame' ), true, 'returns expected value' ); + t.strictEqual( isString( v.frame ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `frame` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'GROUP', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'frame': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `frame` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'GROUP', + 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 title = new Title(); + title.frame = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `frame` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( title.frame, 'bounds', 'returns expected value' ); + + title = new Title({ + 'frame': 'group' + }); + t.strictEqual( title.frame, 'group', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `frame` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.frame = 'group'; + t.strictEqual( title.frame, 'group', 'returns expected value' ); + + title.frame = 'bounds'; + t.strictEqual( title.frame, 'bounds', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `frame` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.frame = 'group'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.frame = 'bounds'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.frame = 'bounds'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.js new file mode 100644 index 000000000000..92e3958e0bec --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.js @@ -0,0 +1,252 @@ +/** +* @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 isSameArray = require( '@stdlib/assert/is-same-array' ); +var instanceOf = require( '@stdlib/assert/instance-of' ); +var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function is a constructor', function test( t ) { + var title = new Title(); + t.strictEqual( instanceOf( title, Title ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor does not require the `new` keyword', function test( t ) { + var title; + var ctor; + + ctor = Title; + title = ctor(); + t.strictEqual( instanceOf( title, Title ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor does not require the `new` keyword (options)', function test( t ) { + var title; + var ctor; + + ctor = Title; + title = ctor({ + 'text': 'Beep boop' + }); + t.strictEqual( instanceOf( title, Title ), true, 'returns expected value' ); + t.strictEqual( isSameArray( title.text, [ 'Beep boop' ] ), 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 title = new Title( value ); // eslint-disable-line no-unused-vars + }; + } +}); + +tape( 'the constructor has a read-only `name` property', function test( t ) { + t.strictEqual( Title.name, 'Title', '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 title; + var json; + + title = new Title(); + json = title.toJSON(); + + expected = { + 'anchor': 'middle', + 'aria': true, + 'frame': 'bounds', + 'orient': 'top', + 'text': [], + '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 title; + var json; + + title = new Title({ + 'text': 'Beep boop', + 'align': 'left', + 'anchor': 'start', + 'angle': 90, + 'aria': false, + 'baseline': 'top', + 'color': 'steelblue', + 'dx': 2, + 'dy': 2, + 'encode': { + 'title': { + 'enter': { + 'fill': { + 'value': 'steelblue' + } + } + } + }, + 'font': 'Arial', + 'fontSize': 12, + 'fontStyle': 'Arial', + 'fontWeight': 'bold', + 'frame': 'group', + 'limit': 100, + 'lineHeight': 2, + 'offset': 12, + 'orient': 'bottom', + 'subtitle': 'foo bar', + 'subtitleColor': 'steelblue', + 'subtitleFont': 'Arial', + 'subtitleFontSize': 14, + 'subtitleFontStyle': 'italic', + 'subtitleFontWeight': 'bold', + 'subtitleLineHeight': 16, + 'subtitlePadding': 24, + 'zindex': 2 + }); + json = title.toJSON(); + + expected = { + 'align': 'left', + 'anchor': 'start', + 'angle': 90, + 'aria': false, + 'baseline': 'top', + 'color': 'steelblue', + 'dx': 2, + 'dy': 2, + 'encode': { + 'title': { + 'enter': { + 'fill': { + 'value': 'steelblue' + } + } + } + }, + 'font': 'Arial', + 'fontSize': 12, + 'fontStyle': 'Arial', + 'fontWeight': 'bold', + 'frame': 'group', + 'limit': 100, + 'lineHeight': 2, + 'offset': 12, + 'orient': 'bottom', + 'subtitle': [ 'foo bar' ], + 'subtitleColor': 'steelblue', + 'subtitleFont': 'Arial', + 'subtitleFontSize': 14, + 'subtitleFontStyle': 'italic', + 'subtitleFontWeight': 'bold', + 'subtitleLineHeight': 16, + 'subtitlePadding': 24, + 'text': [ 'Beep boop' ], + '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 title; + + title = new Title({ + 'text': 'Beep boop' + }); + + expected = { + 'aria': true, + 'anchor': 'middle', + 'frame': 'bounds', + 'orient': 'top', + 'text': [ 'Beep boop' ], + 'zindex': 0 + }; + t.strictEqual( JSON.stringify( title ), JSON.stringify( expected ), 'returns expected value' ); + t.end(); +}); + +tape( 'the constructor returns an instance which inherits from EventEmitter', function test( t ) { + var title; + + title = new Title(); + + t.strictEqual( typeof title.on, 'function', 'returns expected value' ); + t.strictEqual( typeof title.emit, 'function', 'returns expected value' ); + t.strictEqual( typeof title.removeListener, 'function', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor ignores unrecognized options', function test( t ) { + var title; + + title = new Title({ + 'text': 'Beep boop', + 'beep': 'boop', + 'foo': 'bar' + }); + + t.strictEqual( isSameArray( title.text, [ 'Beep boop' ] ), true, 'returns expected value' ); + t.strictEqual( hasOwnProp( title, 'beep' ), false, 'returns expected value' ); + t.strictEqual( hasOwnProp( title, 'foo' ), false, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.limit.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.limit.js new file mode 100644 index 000000000000..44082b47ecba --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.limit.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `limit` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'limit' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'limit' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.limit ), true, 'returns expected value' ); + + v = new Title({ + 'limit': 100 + }); + t.strictEqual( isNumber( v.limit ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `limit` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'limit': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `limit` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title(); + title.limit = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `limit` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.limit ), true, 'returns expected value' ); + + title = new Title({ + 'limit': 100 + }); + t.strictEqual( title.limit, 100, 'returns expected value' ); + + title = new Title({ + 'limit': 150 + }); + t.strictEqual( title.limit, 150, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `limit` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.limit = 100; + t.strictEqual( title.limit, 100, 'returns expected value' ); + + title.limit = 150; + t.strictEqual( title.limit, 150, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `limit` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.limit = 100; + t.strictEqual( count, 1, 'returns expected value' ); + + title.limit = 150; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.limit = 150; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.line_height.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.line_height.js new file mode 100644 index 000000000000..b8d59abbf1e5 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.line_height.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `lineHeight` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'lineHeight' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'lineHeight' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.lineHeight ), true, 'returns expected value' ); + + v = new Title({ + 'lineHeight': 2 + }); + t.strictEqual( isNumber( v.lineHeight ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `lineHeight` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'lineHeight': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `lineHeight` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title(); + title.lineHeight = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `lineHeight` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.lineHeight ), true, 'returns expected value' ); + + title = new Title({ + 'lineHeight': 2 + }); + t.strictEqual( title.lineHeight, 2, 'returns expected value' ); + + title = new Title({ + 'lineHeight': 4 + }); + t.strictEqual( title.lineHeight, 4, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `lineHeight` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.lineHeight = 2; + t.strictEqual( title.lineHeight, 2, 'returns expected value' ); + + title.lineHeight = 4; + t.strictEqual( title.lineHeight, 4, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `lineHeight` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.lineHeight = 2; + t.strictEqual( count, 1, 'returns expected value' ); + + title.lineHeight = 4; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.lineHeight = 4; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.offset.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.offset.js new file mode 100644 index 000000000000..f12bdc8d130b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.offset.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `offset` property', function test( t ) { + var v; + + v = new Title(); + 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 Title({ + 'offset': 12 + }); + 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', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'offset': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `offset` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title(); + title.offset = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `offset` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.offset ), true, 'returns expected value' ); + + title = new Title({ + 'offset': 12 + }); + t.strictEqual( title.offset, 12, 'returns expected value' ); + + title = new Title({ + 'offset': 14 + }); + t.strictEqual( title.offset, 14, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `offset` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.offset = 12; + t.strictEqual( title.offset, 12, 'returns expected value' ); + + title.offset = 14; + t.strictEqual( title.offset, 14, '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 title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.offset = 12; + t.strictEqual( count, 1, 'returns expected value' ); + + title.offset = 14; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.offset = 14; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.orient.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.orient.js new file mode 100644 index 000000000000..73b84a822f61 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.orient.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 isString = require( '@stdlib/assert/is-string' ); +var Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, '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 Title(); + 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, + 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 title = new Title({ // eslint-disable-line no-unused-vars + '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, + 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 title = new Title(); + title.orient = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `orient` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( title.orient, 'top', 'returns expected value' ); + + title = new Title({ + 'orient': 'bottom' + }); + t.strictEqual( title.orient, 'bottom', 'returns expected value' ); + + title = new Title({ + 'orient': 'left' + }); + t.strictEqual( title.orient, 'left', 'returns expected value' ); + + title = new Title({ + 'orient': 'right' + }); + t.strictEqual( title.orient, 'right', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `orient` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.orient = 'bottom'; + t.strictEqual( title.orient, 'bottom', 'returns expected value' ); + + title.orient = 'top'; + t.strictEqual( title.orient, 'top', 'returns expected value' ); + + title.orient = 'left'; + t.strictEqual( title.orient, 'left', 'returns expected value' ); + + title.orient = 'right'; + t.strictEqual( title.orient, 'right', '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 title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.orient = 'bottom'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.orient = 'top'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.orient = 'top'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.properties.js new file mode 100644 index 000000000000..be0d60b5f707 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.properties.js @@ -0,0 +1,77 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, '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 Title(); + 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 title; + var props; + + title = new Title(); + props = title.properties; + + t.strictEqual( isArray( props ), true, 'returns expected value' ); + + expected = [ 'aria', 'align', 'anchor', 'angle', 'baseline', 'color', 'dx', 'dy', 'encode', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'frame', 'limit', 'lineHeight', 'offset', 'orient', 'subtitle', 'subtitleColor', 'subtitleFont', 'subtitleFontSize', 'subtitleFontStyle', 'subtitleFontWeight', 'subtitleLineHeight', 'subtitlePadding', 'text', '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 title; + + title = new Title(); + props1 = title.properties; + props2 = title.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/title/ctor/test/test.subtitle.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle.js new file mode 100644 index 000000000000..b65c5f047527 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle.js @@ -0,0 +1,167 @@ +/** +* @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 isSameArray = require( '@stdlib/assert/is-same-array' ); +var Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `subtitle` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'subtitle' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'subtitle' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.subtitle ), true, 'returns expected value' ); + + v = new Title({ + 'subtitle': 'foo bar' + }); + t.strictEqual( isSameArray( v.subtitle, [ 'foo bar' ] ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `subtitle` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitle': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitle` 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 title = new Title(); + title.subtitle = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitle` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.subtitle ), true, 'returns expected value' ); + + title = new Title({ + 'subtitle': 'foo bar' + }); + t.strictEqual( isSameArray( title.subtitle, [ 'foo bar' ] ), true, 'returns expected value' ); + + title = new Title({ + 'subtitle': 'beep boop' + }); + t.strictEqual( isSameArray( title.subtitle, [ 'beep boop' ] ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `subtitle` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.subtitle = 'foo bar'; + t.strictEqual( isSameArray( title.subtitle, [ 'foo bar' ] ), true, 'returns expected value' ); + + title.subtitle = 'beep boop'; + t.strictEqual( isSameArray( title.subtitle, [ 'beep boop' ] ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `subtitle` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.subtitle = 'beep boop'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.subtitle = 'foo bar'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.subtitle = 'foo bar'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_color.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_color.js new file mode 100644 index 000000000000..3e1f580d7cf2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_color.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `subtitleColor` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'subtitleColor' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'subtitleColor' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.subtitleColor ), true, 'returns expected value' ); + + v = new Title({ + 'subtitleColor': 'red' + }); + t.strictEqual( isString( v.subtitleColor ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleColor` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleColor': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleColor` 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 title = new Title(); + title.subtitleColor = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleColor` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.subtitleColor ), true, 'returns expected value' ); + + title = new Title({ + 'subtitleColor': 'steelblue' + }); + t.strictEqual( title.subtitleColor, 'steelblue', 'returns expected value' ); + + title = new Title({ + 'subtitleColor': 'red' + }); + t.strictEqual( title.subtitleColor, 'red', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `subtitleColor` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.subtitleColor = 'steelblue'; + t.strictEqual( title.subtitleColor, 'steelblue', 'returns expected value' ); + + title.subtitleColor = 'red'; + t.strictEqual( title.subtitleColor, 'red', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `subtitleColor` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.subtitleColor = 'red'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.subtitleColor = 'steelblue'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.subtitleColor = 'steelblue'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font.js new file mode 100644 index 000000000000..83d74429680b --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `subtitleFont` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'subtitleFont' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'subtitleFont' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.subtitleFont ), true, 'returns expected value' ); + + v = new Title({ + 'subtitleFont': 'Arial' + }); + t.strictEqual( isString( v.subtitleFont ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleFont` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleFont': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleFont` 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 title = new Title(); + title.subtitleFont = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleFont` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.subtitleFont ), true, 'returns expected value' ); + + title = new Title({ + 'subtitleFont': 'Arial' + }); + t.strictEqual( title.subtitleFont, 'Arial', 'returns expected value' ); + + title = new Title({ + 'subtitleFont': 'Sans' + }); + t.strictEqual( title.subtitleFont, 'Sans', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `subtitleFont` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.subtitleFont = 'Arial'; + t.strictEqual( title.subtitleFont, 'Arial', 'returns expected value' ); + + title.subtitleFont = 'Sans'; + t.strictEqual( title.subtitleFont, 'Sans', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `subtitleFont` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.subtitleFont = 'Sans'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.subtitleFont = 'Arial'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.subtitleFont = 'Arial'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_size.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_size.js new file mode 100644 index 000000000000..4a0817d999b6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_size.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `subtitleFontSize` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'subtitleFontSize' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'subtitleFontSize' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.subtitleFontSize ), true, 'returns expected value' ); + + v = new Title({ + 'subtitleFontSize': 12 + }); + t.strictEqual( isNumber( v.subtitleFontSize ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleFontSize` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleFontSize': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleFontSize` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title(); + title.subtitleFontSize = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleFontSize` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.subtitleFontSize ), true, 'returns expected value' ); + + title = new Title({ + 'subtitleFontSize': 12 + }); + t.strictEqual( title.subtitleFontSize, 12, 'returns expected value' ); + + title = new Title({ + 'subtitleFontSize': 14 + }); + t.strictEqual( title.subtitleFontSize, 14, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `subtitleFontSize` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.subtitleFontSize = 12; + t.strictEqual( title.subtitleFontSize, 12, 'returns expected value' ); + + title.subtitleFontSize = 14; + t.strictEqual( title.subtitleFontSize, 14, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `subtitleFontSize` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.subtitleFontSize = 12; + t.strictEqual( count, 1, 'returns expected value' ); + + title.subtitleFontSize = 14; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.subtitleFontSize = 14; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_style.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_style.js new file mode 100644 index 000000000000..4e85816fa7f6 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_style.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `subtitleFontStyle` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'subtitleFontStyle' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'subtitleFontStyle' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.subtitleFontStyle ), true, 'returns expected value' ); + + v = new Title({ + 'subtitleFontStyle': 'Arial' + }); + t.strictEqual( isString( v.subtitleFontStyle ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleFontStyle` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleFontStyle': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleFontStyle` 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 title = new Title(); + title.subtitleFontStyle = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleFontStyle` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.subtitleFontStyle ), true, 'returns expected value' ); + + title = new Title({ + 'subtitleFontStyle': 'Arial' + }); + t.strictEqual( title.subtitleFontStyle, 'Arial', 'returns expected value' ); + + title = new Title({ + 'subtitleFontStyle': 'Sans' + }); + t.strictEqual( title.subtitleFontStyle, 'Sans', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `subtitleFontStyle` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.subtitleFontStyle = 'Arial'; + t.strictEqual( title.subtitleFontStyle, 'Arial', 'returns expected value' ); + + title.subtitleFontStyle = 'Sans'; + t.strictEqual( title.subtitleFontStyle, 'Sans', 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `subtitleFontStyle` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.subtitleFontStyle = 'Sans'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.subtitleFontStyle = 'Arial'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.subtitleFontStyle = 'Arial'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_weight.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_weight.js new file mode 100644 index 000000000000..7550a20798e2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_weight.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 isString = require( '@stdlib/assert/is-string' ); +var isNumber = require( '@stdlib/assert/is-number' ); +var Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `subtitleFontWeight` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'subtitleFontWeight' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'subtitleFontWeight' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.subtitleFontWeight ), true, 'returns expected value' ); + + v = new Title({ + 'subtitleFontWeight': 'bold' + }); + t.strictEqual( isString( v.subtitleFontWeight ), true, 'returns expected value' ); + + v = new Title({ + 'subtitleFontWeight': 6 + }); + t.strictEqual( isNumber( v.subtitleFontWeight ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleFontWeight` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleFontWeight': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleFontWeight` 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 title = new Title(); + title.subtitleFontWeight = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleFontWeight` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.subtitleFontWeight ), true, 'returns expected value' ); + + title = new Title({ + 'subtitleFontWeight': 'bold' + }); + t.strictEqual( title.subtitleFontWeight, 'bold', 'returns expected value' ); + + title = new Title({ + 'subtitleFontWeight': 'light' + }); + t.strictEqual( title.subtitleFontWeight, 'light', 'returns expected value' ); + + title = new Title({ + 'subtitleFontWeight': 6 + }); + t.strictEqual( title.subtitleFontWeight, 6, 'returns expected value' ); + + title = new Title({ + 'subtitleFontWeight': 8 + }); + t.strictEqual( title.subtitleFontWeight, 8, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `subtitleFontWeight` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.subtitleFontWeight = 'bold'; + t.strictEqual( title.subtitleFontWeight, 'bold', 'returns expected value' ); + + title.subtitleFontWeight = 'light'; + t.strictEqual( title.subtitleFontWeight, 'light', 'returns expected value' ); + + title.subtitleFontWeight = 6; + t.strictEqual( title.subtitleFontWeight, 6, 'returns expected value' ); + + title.subtitleFontWeight = 8; + t.strictEqual( title.subtitleFontWeight, 8, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `subtitleFontWeight` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.subtitleFontWeight = 'light'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.subtitleFontWeight = 'bold'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.subtitleFontWeight = 'bold'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_line_height.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_line_height.js new file mode 100644 index 000000000000..08b25dcbfe6f --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_line_height.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `subtitleLineHeight` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'subtitleLineHeight' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'subtitleLineHeight' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.subtitleLineHeight ), true, 'returns expected value' ); + + v = new Title({ + 'subtitleLineHeight': 2 + }); + t.strictEqual( isNumber( v.subtitleLineHeight ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleLineHeight` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleLineHeight': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleLineHeight` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title(); + title.subtitleLineHeight = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitleLineHeight` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.subtitleLineHeight ), true, 'returns expected value' ); + + title = new Title({ + 'subtitleLineHeight': 2 + }); + t.strictEqual( title.subtitleLineHeight, 2, 'returns expected value' ); + + title = new Title({ + 'subtitleLineHeight': 4 + }); + t.strictEqual( title.subtitleLineHeight, 4, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `subtitleLineHeight` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.subtitleLineHeight = 2; + t.strictEqual( title.subtitleLineHeight, 2, 'returns expected value' ); + + title.subtitleLineHeight = 4; + t.strictEqual( title.subtitleLineHeight, 4, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `subtitleLineHeight` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.subtitleLineHeight = 2; + t.strictEqual( count, 1, 'returns expected value' ); + + title.subtitleLineHeight = 4; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.subtitleLineHeight = 4; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_padding.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_padding.js new file mode 100644 index 000000000000..a654106b8bb2 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_padding.js @@ -0,0 +1,167 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `subtitlePadding` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'subtitlePadding' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'subtitlePadding' ), true, 'returns expected value' ); + t.strictEqual( isUndefined( v.subtitlePadding ), true, 'returns expected value' ); + + v = new Title({ + 'subtitlePadding': 12 + }); + t.strictEqual( isNumber( v.subtitlePadding ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `subtitlePadding` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitlePadding': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitlePadding` property which throws an error if set to an invalid value', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title(); + title.subtitlePadding = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `subtitlePadding` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isUndefined( title.subtitlePadding ), true, 'returns expected value' ); + + title = new Title({ + 'subtitlePadding': 12 + }); + t.strictEqual( title.subtitlePadding, 12, 'returns expected value' ); + + title = new Title({ + 'subtitlePadding': 14 + }); + t.strictEqual( title.subtitlePadding, 14, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `subtitlePadding` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.subtitlePadding = 12; + t.strictEqual( title.subtitlePadding, 12, 'returns expected value' ); + + title.subtitlePadding = 14; + t.strictEqual( title.subtitlePadding, 14, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `subtitlePadding` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.subtitlePadding = 12; + t.strictEqual( count, 1, 'returns expected value' ); + + title.subtitlePadding = 14; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.subtitlePadding = 14; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.text.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.text.js new file mode 100644 index 000000000000..6fb2d75e1cb9 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.text.js @@ -0,0 +1,165 @@ +/** +* @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 isSameArray = require( '@stdlib/assert/is-same-array' ); +var isEmptyArray = require( '@stdlib/assert/is-empty-array' ); +var Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the constructor returns an instance which has a `text` property', function test( t ) { + var v; + + v = new Title(); + t.strictEqual( hasOwnProp( v, 'text' ), false, 'returns expected value' ); + t.strictEqual( hasProp( v, 'text' ), true, 'returns expected value' ); + t.strictEqual( isEmptyArray( v.text ), true, 'returns expected value' ); + + v = new Title({ + 'text': 'foo bar' + }); + t.strictEqual( isSameArray( v.text, [ 'foo bar' ] ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor throws an error if provided an invalid `text` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'text': value + }); + }; + } +}); + +tape( 'the constructor returns an instance having a `text` 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 title = new Title(); + title.text = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `text` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( isEmptyArray( title.text ), true, 'returns expected value' ); + + title = new Title({ + 'text': 'foo bar' + }); + t.strictEqual( isSameArray( title.text, [ 'foo bar' ] ), true, 'returns expected value' ); + + title = new Title({ + 'text': 'beep boop' + }); + t.strictEqual( isSameArray( title.text, [ 'beep boop' ] ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `text` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.text = 'foo bar'; + t.strictEqual( isSameArray( title.text, [ 'foo bar' ] ), true, 'returns expected value' ); + + title.text = 'beep boop'; + t.strictEqual( isSameArray( title.text, [ 'beep boop' ] ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance which emits an event when the `text` property is set to a new value', function test( t ) { + var title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.text = 'beep boop'; + t.strictEqual( count, 1, 'returns expected value' ); + + title.text = 'foo bar'; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.text = 'foo bar'; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.zindex.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.zindex.js new file mode 100644 index 000000000000..77362a72ffb0 --- /dev/null +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.zindex.js @@ -0,0 +1,161 @@ +/** +* @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 Title = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof Title, '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 Title(); + 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', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + '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', + 'boop', + 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 title = new Title(); + title.zindex = value; + }; + } +}); + +tape( 'the constructor returns an instance having a `zindex` property', function test( t ) { + var title; + + title = new Title(); + t.strictEqual( title.zindex, 0, 'returns expected value' ); + + title = new Title({ + 'zindex': 2 + }); + t.strictEqual( title.zindex, 2, 'returns expected value' ); + + title = new Title({ + 'zindex': 4 + }); + t.strictEqual( title.zindex, 4, 'returns expected value' ); + + t.end(); +}); + +tape( 'the constructor returns an instance having a `zindex` property which can be set to a valid method', function test( t ) { + var title; + + title = new Title(); + + title.zindex = 2; + t.strictEqual( title.zindex, 2, 'returns expected value' ); + + title.zindex = 4; + t.strictEqual( title.zindex, 4, '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 title; + var count; + + title = new Title(); + count = 0; + + title.on( 'change', onChange ); + + title.zindex = 2; + t.strictEqual( count, 1, 'returns expected value' ); + + title.zindex = 4; + t.strictEqual( count, 2, 'returns expected value' ); + + // Setting to the same value should not emit an event: + title.zindex = 4; + t.strictEqual( count, 2, 'returns expected value' ); + + t.end(); + + function onChange() { + count += 1; + } +}); From 83e6761aca342cb35b735c9a50f3f3ccb64e047f Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 11 Mar 2026 23:59:29 -0700 Subject: [PATCH 2/3] chore: clean up --- .../plot/vega/title/ctor/test/test.align.js | 50 +- .../plot/vega/title/ctor/test/test.anchor.js | 53 +- .../plot/vega/title/ctor/test/test.angle.js | 22 +- .../plot/vega/title/ctor/test/test.aria.js | 50 +- .../vega/title/ctor/test/test.baseline.js | 44 +- .../plot/vega/title/ctor/test/test.color.js | 44 +- .../plot/vega/title/ctor/test/test.dx.js | 44 +- .../plot/vega/title/ctor/test/test.dy.js | 44 +- .../plot/vega/title/ctor/test/test.encode.js | 41 +- .../plot/vega/title/ctor/test/test.font.js | 44 +- .../vega/title/ctor/test/test.font_size.js | 46 +- .../vega/title/ctor/test/test.font_style.js | 46 +- .../vega/title/ctor/test/test.font_weight.js | 44 +- .../plot/vega/title/ctor/test/test.frame.js | 47 +- .../@stdlib/plot/vega/title/ctor/test/test.js | 781 +++++++++++++++++- .../plot/vega/title/ctor/test/test.limit.js | 44 +- .../vega/title/ctor/test/test.line_height.js | 44 +- .../plot/vega/title/ctor/test/test.offset.js | 50 +- .../plot/vega/title/ctor/test/test.orient.js | 53 +- .../vega/title/ctor/test/test.properties.js | 35 +- .../vega/title/ctor/test/test.subtitle.js | 47 +- .../title/ctor/test/test.subtitle_color.js | 44 +- .../title/ctor/test/test.subtitle_font.js | 44 +- .../ctor/test/test.subtitle_font_size.js | 44 +- .../ctor/test/test.subtitle_font_style.js | 44 +- .../ctor/test/test.subtitle_font_weight.js | 44 +- .../ctor/test/test.subtitle_line_height.js | 44 +- .../title/ctor/test/test.subtitle_padding.js | 44 +- .../plot/vega/title/ctor/test/test.text.js | 41 +- .../plot/vega/title/ctor/test/test.zindex.js | 44 +- 30 files changed, 962 insertions(+), 1104 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.align.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.align.js index 095b147f4578..bb335b968cc2 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.align.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.align.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -36,10 +36,8 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the constructor returns an instance which has a `align` property', function test( t ) { - var v; - - v = new Title(); +tape( 'the constructor returns an instance which has an `align` property', function test( t ) { + var v = new Title(); t.strictEqual( hasOwnProp( v, 'align' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'align' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.align ), true, 'returns expected value' ); @@ -52,35 +50,7 @@ tape( 'the constructor returns an instance which has a `align` property', functi t.end(); }); -tape( 'the constructor throws an error if provided an invalid `align` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'align': value - }); - }; - } -}); - -tape( 'the constructor returns an instance having a `align` property which throws an error if set to an invalid value', function test( t ) { +tape( 'the constructor returns an instance having an `align` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -107,10 +77,8 @@ tape( 'the constructor returns an instance having a `align` property which throw } }); -tape( 'the constructor returns an instance having a `align` property', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `align` property', function test( t ) { + var title = new Title(); t.strictEqual( isUndefined( title.align ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `align` property', function t.end(); }); -tape( 'the constructor returns an instance having a `align` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `align` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.align = 'left'; t.strictEqual( title.align, 'left', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.anchor.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.anchor.js index 01ee3dfd905e..474faafbee2e 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.anchor.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.anchor.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 isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Title = require( './../lib' ); @@ -35,10 +35,8 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the constructor returns an instance which has a `anchor` property', function test( t ) { - var v; - - v = new Title(); +tape( 'the constructor returns an instance which has an `anchor` property', function test( t ) { + var v = new Title(); t.strictEqual( hasOwnProp( v, 'anchor' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'anchor' ), true, 'returns expected value' ); t.strictEqual( isString( v.anchor ), true, 'returns expected value' ); @@ -46,38 +44,7 @@ tape( 'the constructor returns an instance which has a `anchor` property', funct t.end(); }); -tape( 'the constructor throws an error if provided an invalid `anchor` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'START', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'anchor': value - }); - }; - } -}); - -tape( 'the constructor returns an instance having a `anchor` property which throws an error if set to an invalid value', function test( t ) { +tape( 'the constructor returns an instance having an `anchor` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -107,10 +74,8 @@ tape( 'the constructor returns an instance having a `anchor` property which thro } }); -tape( 'the constructor returns an instance having a `anchor` property', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `anchor` property', function test( t ) { + var title = new Title(); t.strictEqual( title.anchor, 'middle', 'returns expected value' ); title = new Title({ @@ -126,10 +91,8 @@ tape( 'the constructor returns an instance having a `anchor` property', function t.end(); }); -tape( 'the constructor returns an instance having a `anchor` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `anchor` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.anchor = 'start'; t.strictEqual( title.anchor, 'start', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.angle.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.angle.js index 96097ddfc3ee..0fc9e473355c 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.angle.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.angle.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -36,10 +36,8 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the constructor returns an instance which has a `angle` property', function test( t ) { - var v; - - v = new Title(); +tape( 'the constructor returns an instance which has an `angle` property', function test( t ) { + var v = new Title(); t.strictEqual( hasOwnProp( v, 'angle' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'angle' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.angle ), true, 'returns expected value' ); @@ -80,7 +78,7 @@ tape( 'the constructor throws an error if provided an invalid `angle` option', f } }); -tape( 'the constructor returns an instance having a `angle` property which throws an error if set to an invalid value', function test( t ) { +tape( 'the constructor returns an instance having an `angle` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -107,10 +105,8 @@ tape( 'the constructor returns an instance having a `angle` property which throw } }); -tape( 'the constructor returns an instance having a `angle` property', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `angle` property', function test( t ) { + var title = new Title(); t.strictEqual( isUndefined( title.angle ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +122,8 @@ tape( 'the constructor returns an instance having a `angle` property', function t.end(); }); -tape( 'the constructor returns an instance having a `angle` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `angle` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.angle = 90; t.strictEqual( title.angle, 90, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.aria.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.aria.js index b4496bca501d..fdc0053d08ea 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.aria.js +++ b/lib/node_modules/@stdlib/plot/vega/title/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 Title = require( './../lib' ); @@ -35,45 +35,15 @@ 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 ) { - var v; - - v = new Title(); +tape( 'the constructor returns an instance which has an `aria` property', function test( t ) { + var v = new Title(); 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 title = new Title({ // eslint-disable-line no-unused-vars - '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 ) { +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; @@ -100,10 +70,8 @@ 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 ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `aria` property', function test( t ) { + var title = new Title(); t.strictEqual( title.aria, true, 'returns expected value' ); title = new Title({ @@ -119,10 +87,8 @@ 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 ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `aria` property which can be set to a boolean', function test( t ) { + var title = new Title(); title.aria = true; t.strictEqual( title.aria, true, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.baseline.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.baseline.js index a37803d3bae3..c85430794e5a 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.baseline.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.baseline.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `baseline` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'baseline' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'baseline' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.baseline ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `baseline` property', fun t.end(); }); -tape( 'the constructor throws an error if provided an invalid `baseline` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'baseline': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `baseline` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `baseline` property which th }); tape( 'the constructor returns an instance having a `baseline` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.baseline ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `baseline` property', functi t.end(); }); -tape( 'the constructor returns an instance having a `baseline` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `baseline` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.baseline = 'top'; t.strictEqual( title.baseline, 'top', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.color.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.color.js index 5d2d5abd4438..9cee53dd31fe 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.color.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.color.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `color` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'color' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'color' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.color ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `color` property', functi t.end(); }); -tape( 'the constructor throws an error if provided an invalid `color` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'color': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `color` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `color` property which throw }); tape( 'the constructor returns an instance having a `color` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.color ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `color` property', function t.end(); }); -tape( 'the constructor returns an instance having a `color` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `color` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.color = 'steelblue'; t.strictEqual( title.color, 'steelblue', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dx.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dx.js index 16a6d4bef6e8..7bcab5288650 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dx.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dx.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `dx` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'dx' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'dx' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.dx ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `dx` property', function t.end(); }); -tape( 'the constructor throws an error if provided an invalid `dx` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'dx': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `dx` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `dx` property which throws a }); tape( 'the constructor returns an instance having a `dx` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.dx ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `dx` property', function tes t.end(); }); -tape( 'the constructor returns an instance having a `dx` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `dx` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.dx = 2; t.strictEqual( title.dx, 2, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dy.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dy.js index 40905c38aaf2..431a8ac51c6a 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dy.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.dy.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `dy` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'dy' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'dy' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.dy ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `dy` property', function t.end(); }); -tape( 'the constructor throws an error if provided an invalid `dy` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'dy': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `dy` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `dy` property which throws a }); tape( 'the constructor returns an instance having a `dy` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.dy ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `dy` property', function tes t.end(); }); -tape( 'the constructor returns an instance having a `dy` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `dy` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.dy = 2; t.strictEqual( title.dy, 2, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.encode.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.encode.js index 03f84d0a9140..e3c10c602def 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.encode.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.encode.js @@ -36,10 +36,8 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the constructor returns an instance which has a `encode` property', function test( t ) { - var v; - - v = new Title(); +tape( 'the constructor returns an instance which has an `encode` property', function test( t ) { + var v = new Title(); t.strictEqual( hasOwnProp( v, 'encode' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'encode' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.encode ), true, 'returns expected value' ); @@ -60,36 +58,7 @@ tape( 'the constructor returns an instance which has a `encode` property', funct t.end(); }); -tape( 'the constructor throws an error if provided an invalid `encode` option', function test( t ) { - var values; - var i; - - values = [ - 5, - 'beep', - 'boop', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'encode': value - }); - }; - } -}); - -tape( 'the constructor returns an instance having a `encode` property which throws an error if set to an invalid value', function test( t ) { +tape( 'the constructor returns an instance having an `encode` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -117,7 +86,7 @@ tape( 'the constructor returns an instance having a `encode` property which thro } }); -tape( 'the constructor returns an instance having a `encode` property', function test( t ) { +tape( 'the constructor returns an instance having an `encode` property', function test( t ) { var expected; var title; @@ -151,7 +120,7 @@ tape( 'the constructor returns an instance having a `encode` property', function t.end(); }); -tape( 'the constructor returns an instance having a `encode` property which can be set to a valid method', function test( t ) { +tape( 'the constructor returns an instance having an `encode` property which can be set to a valid value', function test( t ) { var expected; var title; diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font.js index dffc122db8bb..22b544ac30b8 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `font` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'font' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'font' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.font ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `font` property', functio t.end(); }); -tape( 'the constructor throws an error if provided an invalid `font` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'font': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `font` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `font` property which throws }); tape( 'the constructor returns an instance having a `font` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.font ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `font` property', function t t.end(); }); -tape( 'the constructor returns an instance having a `font` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `font` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.font = 'Arial'; t.strictEqual( title.font, 'Arial', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_size.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_size.js index a41c8dd5bdf7..59ebf668b70b 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_size.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_size.js @@ -22,9 +22,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 isUndefined = require( '@stdlib/assert/is-undefined' ); +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `fontSize` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'fontSize' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'fontSize' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.fontSize ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `fontSize` property', fun t.end(); }); -tape( 'the constructor throws an error if provided an invalid `fontSize` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'fontSize': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `fontSize` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `fontSize` property which th }); tape( 'the constructor returns an instance having a `fontSize` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.fontSize ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `fontSize` property', functi t.end(); }); -tape( 'the constructor returns an instance having a `fontSize` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `fontSize` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.fontSize = 12; t.strictEqual( title.fontSize, 12, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_style.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_style.js index 18cb1c19f096..937e9cb8bac9 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_style.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_style.js @@ -22,9 +22,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 isUndefined = require( '@stdlib/assert/is-undefined' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `fontStyle` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'fontStyle' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'fontStyle' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.fontStyle ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `fontStyle` property', fu t.end(); }); -tape( 'the constructor throws an error if provided an invalid `fontStyle` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'fontStyle': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `fontStyle` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `fontStyle` property which t }); tape( 'the constructor returns an instance having a `fontStyle` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.fontStyle ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `fontStyle` property', funct t.end(); }); -tape( 'the constructor returns an instance having a `fontStyle` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `fontStyle` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.fontStyle = 'Arial'; t.strictEqual( title.fontStyle, 'Arial', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_weight.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_weight.js index 94657b56f117..9ef9cd6a4339 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_weight.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.font_weight.js @@ -24,8 +24,8 @@ 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' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Title = require( './../lib' ); @@ -38,9 +38,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `fontWeight` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'fontWeight' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'fontWeight' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.fontWeight ), true, 'returns expected value' ); @@ -58,32 +56,6 @@ tape( 'the constructor returns an instance which has a `fontWeight` property', f t.end(); }); -tape( 'the constructor throws an error if provided an invalid `fontWeight` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'fontWeight': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `fontWeight` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -110,9 +82,7 @@ tape( 'the constructor returns an instance having a `fontWeight` property which }); tape( 'the constructor returns an instance having a `fontWeight` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.fontWeight ), true, 'returns expected value' ); title = new Title({ @@ -138,10 +108,8 @@ tape( 'the constructor returns an instance having a `fontWeight` property', func t.end(); }); -tape( 'the constructor returns an instance having a `fontWeight` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `fontWeight` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.fontWeight = 'bold'; t.strictEqual( title.fontWeight, 'bold', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.frame.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.frame.js index 0e5570717866..4a91ae37b87e 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.frame.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.frame.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 isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Title = require( './../lib' ); @@ -36,9 +36,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `frame` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'frame' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'frame' ), true, 'returns expected value' ); t.strictEqual( isString( v.frame ), true, 'returns expected value' ); @@ -46,37 +44,6 @@ tape( 'the constructor returns an instance which has a `frame` property', functi t.end(); }); -tape( 'the constructor throws an error if provided an invalid `frame` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'GROUP', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'frame': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `frame` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +75,7 @@ tape( 'the constructor returns an instance having a `frame` property which throw }); tape( 'the constructor returns an instance having a `frame` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( title.frame, 'bounds', 'returns expected value' ); title = new Title({ @@ -121,10 +86,8 @@ tape( 'the constructor returns an instance having a `frame` property', function t.end(); }); -tape( 'the constructor returns an instance having a `frame` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `frame` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.frame = 'group'; t.strictEqual( title.frame, 'group', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.js index 92e3958e0bec..eeaba0114550 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.js @@ -20,10 +20,10 @@ // MODULES // +var EventEmitter = require( 'events' ).EventEmitter; var tape = require( 'tape' ); var isSameArray = require( '@stdlib/assert/is-same-array' ); var instanceOf = require( '@stdlib/assert/instance-of' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var Title = require( './../lib' ); @@ -91,6 +91,767 @@ tape( 'the constructor throws an error if provided an options argument which is } }); +tape( 'the constructor throws an error if provided an invalid `align` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'align': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `anchor` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'START', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'anchor': value + }); + }; + } +}); + +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 title = new Title({ // eslint-disable-line no-unused-vars + 'aria': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `baseline` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'baseline': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `color` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'color': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `dx` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'dx': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `dy` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'dy': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `encode` option', function test( t ) { + var values; + var i; + + values = [ + 5, + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'encode': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `font` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'font': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `fontSize` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'fontSize': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `fontStyle` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'fontStyle': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `fontWeight` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'fontWeight': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `frame` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 'GROUP', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'frame': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `limit` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'limit': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `lineHeight` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'lineHeight': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `offset` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + '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, + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'orient': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `subtitle` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitle': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleColor` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleColor': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleFont` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleFont': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleFontSize` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleFontSize': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleFontStyle` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleFontStyle': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleFontWeight` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleFontWeight': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `subtitleLineHeight` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitleLineHeight': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `subtitlePadding` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'subtitlePadding': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `text` 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 title = new Title({ // eslint-disable-line no-unused-vars + 'text': value + }); + }; + } +}); + +tape( 'the constructor throws an error if provided an invalid `zindex` option', function test( t ) { + var values; + var i; + + values = [ + 'beep', + 'boop', + 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 title = new Title({ // eslint-disable-line no-unused-vars + 'zindex': value + }); + }; + } +}); + tape( 'the constructor has a read-only `name` property', function test( t ) { t.strictEqual( Title.name, 'Title', 'returns expected value' ); t.end(); @@ -224,29 +985,21 @@ tape( 'the `toJSON` method is implicitly invoked by `JSON.stringify`', function }); tape( 'the constructor returns an instance which inherits from EventEmitter', function test( t ) { - var title; - - title = new Title(); - - t.strictEqual( typeof title.on, 'function', 'returns expected value' ); - t.strictEqual( typeof title.emit, 'function', 'returns expected value' ); - t.strictEqual( typeof title.removeListener, 'function', 'returns expected value' ); - + var title = new Title(); + t.strictEqual( instanceOf( title, EventEmitter ), true, 'returns expected value' ); t.end(); }); tape( 'the constructor ignores unrecognized options', function test( t ) { - var title; - - title = new Title({ + var title = new Title({ 'text': 'Beep boop', 'beep': 'boop', 'foo': 'bar' }); t.strictEqual( isSameArray( title.text, [ 'Beep boop' ] ), true, 'returns expected value' ); - t.strictEqual( hasOwnProp( title, 'beep' ), false, 'returns expected value' ); - t.strictEqual( hasOwnProp( title, 'foo' ), false, 'returns expected value' ); + t.strictEqual( title.beep, void 0, 'returns expected value' ); + t.strictEqual( title.foo, void 0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.limit.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.limit.js index 44082b47ecba..abc436fdd39a 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.limit.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.limit.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `limit` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'limit' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'limit' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.limit ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `limit` property', functi t.end(); }); -tape( 'the constructor throws an error if provided an invalid `limit` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'limit': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `limit` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `limit` property which throw }); tape( 'the constructor returns an instance having a `limit` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.limit ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `limit` property', function t.end(); }); -tape( 'the constructor returns an instance having a `limit` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `limit` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.limit = 100; t.strictEqual( title.limit, 100, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.line_height.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.line_height.js index b8d59abbf1e5..5c0ddf1cd889 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.line_height.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.line_height.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `lineHeight` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'lineHeight' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'lineHeight' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.lineHeight ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `lineHeight` property', f t.end(); }); -tape( 'the constructor throws an error if provided an invalid `lineHeight` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'lineHeight': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `lineHeight` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `lineHeight` property which }); tape( 'the constructor returns an instance having a `lineHeight` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.lineHeight ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `lineHeight` property', func t.end(); }); -tape( 'the constructor returns an instance having a `lineHeight` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `lineHeight` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.lineHeight = 2; t.strictEqual( title.lineHeight, 2, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.offset.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.offset.js index f12bdc8d130b..a7e9afb4ffb0 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.offset.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.offset.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -36,10 +36,8 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the constructor returns an instance which has a `offset` property', function test( t ) { - var v; - - v = new Title(); +tape( 'the constructor returns an instance which has an `offset` property', function test( t ) { + var v = new Title(); 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' ); @@ -52,35 +50,7 @@ tape( 'the constructor returns an instance which has a `offset` property', funct t.end(); }); -tape( 'the constructor throws an error if provided an invalid `offset` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'offset': value - }); - }; - } -}); - -tape( 'the constructor returns an instance having a `offset` property which throws an error if set to an invalid value', function test( t ) { +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; @@ -107,10 +77,8 @@ tape( 'the constructor returns an instance having a `offset` property which thro } }); -tape( 'the constructor returns an instance having a `offset` property', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `offset` property', function test( t ) { + var title = new Title(); t.strictEqual( isUndefined( title.offset ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `offset` property', function t.end(); }); -tape( 'the constructor returns an instance having a `offset` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `offset` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.offset = 12; t.strictEqual( title.offset, 12, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.orient.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.orient.js index 73b84a822f61..f9fe53b3cfd7 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.orient.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.orient.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 isString = require( '@stdlib/assert/is-string' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var Title = require( './../lib' ); @@ -35,10 +35,8 @@ 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 ) { - var v; - - v = new Title(); +tape( 'the constructor returns an instance which has an `orient` property', function test( t ) { + var v = new Title(); 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' ); @@ -46,38 +44,7 @@ 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, - 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 title = new Title({ // eslint-disable-line no-unused-vars - '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 ) { +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; @@ -107,10 +74,8 @@ 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 ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `orient` property', function test( t ) { + var title = new Title(); t.strictEqual( title.orient, 'top', 'returns expected value' ); title = new Title({ @@ -131,10 +96,8 @@ 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 method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having an `orient` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.orient = 'bottom'; t.strictEqual( title.orient, 'bottom', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.properties.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.properties.js index be0d60b5f707..7ecf30c848d5 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.properties.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.properties.js @@ -36,9 +36,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `properties` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); 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' ); @@ -55,7 +53,36 @@ tape( 'the constructor returns an instance having a `properties` property which t.strictEqual( isArray( props ), true, 'returns expected value' ); - expected = [ 'aria', 'align', 'anchor', 'angle', 'baseline', 'color', 'dx', 'dy', 'encode', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'frame', 'limit', 'lineHeight', 'offset', 'orient', 'subtitle', 'subtitleColor', 'subtitleFont', 'subtitleFontSize', 'subtitleFontStyle', 'subtitleFontWeight', 'subtitleLineHeight', 'subtitlePadding', 'text', 'zindex' ]; + expected = [ + 'aria', + 'align', + 'anchor', + 'angle', + 'baseline', + 'color', + 'dx', + 'dy', + 'encode', + 'font', + 'fontSize', + 'fontStyle', + 'fontWeight', + 'frame', + 'limit', + 'lineHeight', + 'offset', + 'orient', + 'subtitle', + 'subtitleColor', + 'subtitleFont', + 'subtitleFontSize', + 'subtitleFontStyle', + 'subtitleFontWeight', + 'subtitleLineHeight', + 'subtitlePadding', + 'text', + 'zindex' + ]; t.deepEqual( props, expected, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle.js index b65c5f047527..8d390b832f76 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle.js @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `subtitle` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'subtitle' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'subtitle' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.subtitle ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `subtitle` property', fun t.end(); }); -tape( 'the constructor throws an error if provided an invalid `subtitle` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'subtitle': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `subtitle` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `subtitle` property which th }); tape( 'the constructor returns an instance having a `subtitle` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.subtitle ), true, 'returns expected value' ); title = new Title({ @@ -126,15 +94,16 @@ tape( 'the constructor returns an instance having a `subtitle` property', functi t.end(); }); -tape( 'the constructor returns an instance having a `subtitle` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `subtitle` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.subtitle = 'foo bar'; t.strictEqual( isSameArray( title.subtitle, [ 'foo bar' ] ), true, 'returns expected value' ); - title.subtitle = 'beep boop'; + title.subtitle = void 0; + t.strictEqual( title.subtitle, void 0, 'returns expected value' ); + + title.subtitle = [ 'beep boop' ]; t.strictEqual( isSameArray( title.subtitle, [ 'beep boop' ] ), true, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_color.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_color.js index 3e1f580d7cf2..80d946ce1900 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_color.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_color.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `subtitleColor` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'subtitleColor' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'subtitleColor' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.subtitleColor ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `subtitleColor` property' t.end(); }); -tape( 'the constructor throws an error if provided an invalid `subtitleColor` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'subtitleColor': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `subtitleColor` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `subtitleColor` property whi }); tape( 'the constructor returns an instance having a `subtitleColor` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.subtitleColor ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `subtitleColor` property', f t.end(); }); -tape( 'the constructor returns an instance having a `subtitleColor` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `subtitleColor` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.subtitleColor = 'steelblue'; t.strictEqual( title.subtitleColor, 'steelblue', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font.js index 83d74429680b..ba89f77721ee 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `subtitleFont` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'subtitleFont' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'subtitleFont' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.subtitleFont ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `subtitleFont` property', t.end(); }); -tape( 'the constructor throws an error if provided an invalid `subtitleFont` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'subtitleFont': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `subtitleFont` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `subtitleFont` property whic }); tape( 'the constructor returns an instance having a `subtitleFont` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.subtitleFont ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `subtitleFont` property', fu t.end(); }); -tape( 'the constructor returns an instance having a `subtitleFont` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `subtitleFont` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.subtitleFont = 'Arial'; t.strictEqual( title.subtitleFont, 'Arial', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_size.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_size.js index 4a0817d999b6..497a7aee9482 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_size.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_size.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `subtitleFontSize` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'subtitleFontSize' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'subtitleFontSize' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.subtitleFontSize ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `subtitleFontSize` proper t.end(); }); -tape( 'the constructor throws an error if provided an invalid `subtitleFontSize` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'subtitleFontSize': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `subtitleFontSize` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `subtitleFontSize` property }); tape( 'the constructor returns an instance having a `subtitleFontSize` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.subtitleFontSize ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `subtitleFontSize` property' t.end(); }); -tape( 'the constructor returns an instance having a `subtitleFontSize` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `subtitleFontSize` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.subtitleFontSize = 12; t.strictEqual( title.subtitleFontSize, 12, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_style.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_style.js index 4e85816fa7f6..4c05e1e33dba 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_style.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_style.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `subtitleFontStyle` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'subtitleFontStyle' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'subtitleFontStyle' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.subtitleFontStyle ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `subtitleFontStyle` prope t.end(); }); -tape( 'the constructor throws an error if provided an invalid `subtitleFontStyle` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'subtitleFontStyle': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `subtitleFontStyle` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `subtitleFontStyle` property }); tape( 'the constructor returns an instance having a `subtitleFontStyle` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.subtitleFontStyle ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `subtitleFontStyle` property t.end(); }); -tape( 'the constructor returns an instance having a `subtitleFontStyle` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `subtitleFontStyle` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.subtitleFontStyle = 'Arial'; t.strictEqual( title.subtitleFontStyle, 'Arial', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_weight.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_weight.js index 7550a20798e2..f3df77b9d784 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_weight.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_font_weight.js @@ -24,8 +24,8 @@ 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' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var Title = require( './../lib' ); @@ -38,9 +38,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `subtitleFontWeight` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'subtitleFontWeight' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'subtitleFontWeight' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.subtitleFontWeight ), true, 'returns expected value' ); @@ -58,32 +56,6 @@ tape( 'the constructor returns an instance which has a `subtitleFontWeight` prop t.end(); }); -tape( 'the constructor throws an error if provided an invalid `subtitleFontWeight` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'subtitleFontWeight': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `subtitleFontWeight` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -110,9 +82,7 @@ tape( 'the constructor returns an instance having a `subtitleFontWeight` propert }); tape( 'the constructor returns an instance having a `subtitleFontWeight` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.subtitleFontWeight ), true, 'returns expected value' ); title = new Title({ @@ -138,10 +108,8 @@ tape( 'the constructor returns an instance having a `subtitleFontWeight` propert t.end(); }); -tape( 'the constructor returns an instance having a `subtitleFontWeight` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `subtitleFontWeight` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.subtitleFontWeight = 'bold'; t.strictEqual( title.subtitleFontWeight, 'bold', 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_line_height.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_line_height.js index 08b25dcbfe6f..046201906a9f 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_line_height.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_line_height.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `subtitleLineHeight` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'subtitleLineHeight' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'subtitleLineHeight' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.subtitleLineHeight ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `subtitleLineHeight` prop t.end(); }); -tape( 'the constructor throws an error if provided an invalid `subtitleLineHeight` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'subtitleLineHeight': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `subtitleLineHeight` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `subtitleLineHeight` propert }); tape( 'the constructor returns an instance having a `subtitleLineHeight` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.subtitleLineHeight ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `subtitleLineHeight` propert t.end(); }); -tape( 'the constructor returns an instance having a `subtitleLineHeight` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `subtitleLineHeight` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.subtitleLineHeight = 2; t.strictEqual( title.subtitleLineHeight, 2, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_padding.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_padding.js index a654106b8bb2..2f9dc788bacf 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_padding.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.subtitle_padding.js @@ -24,7 +24,7 @@ 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 Title = require( './../lib' ); @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `subtitlePadding` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'subtitlePadding' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'subtitlePadding' ), true, 'returns expected value' ); t.strictEqual( isUndefined( v.subtitlePadding ), true, 'returns expected value' ); @@ -52,34 +50,6 @@ tape( 'the constructor returns an instance which has a `subtitlePadding` propert t.end(); }); -tape( 'the constructor throws an error if provided an invalid `subtitlePadding` option', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 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 title = new Title({ // eslint-disable-line no-unused-vars - 'subtitlePadding': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `subtitlePadding` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -108,9 +78,7 @@ tape( 'the constructor returns an instance having a `subtitlePadding` property w }); tape( 'the constructor returns an instance having a `subtitlePadding` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isUndefined( title.subtitlePadding ), true, 'returns expected value' ); title = new Title({ @@ -126,10 +94,8 @@ tape( 'the constructor returns an instance having a `subtitlePadding` property', t.end(); }); -tape( 'the constructor returns an instance having a `subtitlePadding` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `subtitlePadding` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.subtitlePadding = 12; t.strictEqual( title.subtitlePadding, 12, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.text.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.text.js index 6fb2d75e1cb9..654dbdd0bd75 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.text.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.text.js @@ -37,9 +37,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `text` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); t.strictEqual( hasOwnProp( v, 'text' ), false, 'returns expected value' ); t.strictEqual( hasProp( v, 'text' ), true, 'returns expected value' ); t.strictEqual( isEmptyArray( v.text ), true, 'returns expected value' ); @@ -52,33 +50,6 @@ tape( 'the constructor returns an instance which has a `text` property', functio t.end(); }); -tape( 'the constructor throws an error if provided an invalid `text` 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 title = new Title({ // eslint-disable-line no-unused-vars - 'text': value - }); - }; - } -}); - tape( 'the constructor returns an instance having a `text` property which throws an error if set to an invalid value', function test( t ) { var values; var i; @@ -106,9 +77,7 @@ tape( 'the constructor returns an instance having a `text` property which throws }); tape( 'the constructor returns an instance having a `text` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( isEmptyArray( title.text ), true, 'returns expected value' ); title = new Title({ @@ -124,10 +93,8 @@ tape( 'the constructor returns an instance having a `text` property', function t t.end(); }); -tape( 'the constructor returns an instance having a `text` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `text` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.text = 'foo bar'; t.strictEqual( isSameArray( title.text, [ 'foo bar' ] ), true, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.zindex.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.zindex.js index 77362a72ffb0..31ab1145aaf1 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.zindex.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/test/test.zindex.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 Title = require( './../lib' ); @@ -36,9 +36,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the constructor returns an instance which has a `zindex` property', function test( t ) { - var v; - - v = new Title(); + var v = new Title(); 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' ); @@ -46,34 +44,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', - 'boop', - 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 title = new Title({ // eslint-disable-line no-unused-vars - '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; @@ -102,9 +72,7 @@ tape( 'the constructor returns an instance having a `zindex` property which thro }); tape( 'the constructor returns an instance having a `zindex` property', function test( t ) { - var title; - - title = new Title(); + var title = new Title(); t.strictEqual( title.zindex, 0, 'returns expected value' ); title = new Title({ @@ -120,10 +88,8 @@ tape( 'the constructor returns an instance having a `zindex` property', function t.end(); }); -tape( 'the constructor returns an instance having a `zindex` property which can be set to a valid method', function test( t ) { - var title; - - title = new Title(); +tape( 'the constructor returns an instance having a `zindex` property which can be set to a valid value', function test( t ) { + var title = new Title(); title.zindex = 2; t.strictEqual( title.zindex, 2, 'returns expected value' ); From f843ed4e27c98c38b8eef70c2c561ecd24782c6e Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 12 Mar 2026 00:01:51 -0700 Subject: [PATCH 3/3] style: disable lint rule --- lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js index 17a4bb3d7c37..d52737d461f5 100644 --- a/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js +++ b/lib/node_modules/@stdlib/plot/vega/title/ctor/lib/main.js @@ -16,7 +16,7 @@ * limitations under the License. */ -/* eslint-disable no-restricted-syntax, no-invalid-this */ +/* eslint-disable no-restricted-syntax, no-invalid-this, stdlib/no-empty-lines-between-requires */ 'use strict';