Skip to content

Commit a5bc7fe

Browse files
committed
add a few test cases for coerce + 'info_array'
1 parent 0b3040b commit a5bc7fe

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/jasmine/tests/lib_test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,22 @@ describe('Test lib.js:', function() {
626626
.toEqual([0.5, 1]);
627627
});
628628

629+
it('should coerce unexpected input as best as it can', function() {
630+
expect(coerce({range: [12]}, {}, infoArrayAttrs, 'range'))
631+
.toEqual([12]);
629632

633+
expect(coerce({range: [12]}, {}, infoArrayAttrs, 'range', [-1, 20]))
634+
.toEqual([12, 20]);
635+
636+
expect(coerce({domain: [0.5]}, {}, infoArrayAttrs, 'domain'))
637+
.toEqual([0.5, 1]);
638+
639+
expect(coerce({range: ['-10', 100, 12]}, {}, infoArrayAttrs, 'range'))
640+
.toEqual([-10, 100]);
641+
642+
expect(coerce({domain: [0, 0.5, 1]}, {}, infoArrayAttrs, 'domain'))
643+
.toEqual([0, 0.5]);
644+
});
630645
});
631646

632647
describe('subplotid valtype', function() {

0 commit comments

Comments
 (0)