Skip to content

Commit c27653c

Browse files
author
Ignacio Martinez
committed
Add tests for minexponent attribute
1 parent 65ae0f0 commit c27653c

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

test/jasmine/tests/axes_test.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,6 +2851,57 @@ describe('Test axes', function() {
28512851
]);
28522852
});
28532853

2854+
it('Does not use SI prefixes for 10^n with |n| < minexponent', function() {
2855+
var textOut = mockCalc({
2856+
type: 'log',
2857+
tickmode: 'linear',
2858+
exponentformat: 'SI',
2859+
minexponent: 5,
2860+
showexponent: 'all',
2861+
tick0: 0,
2862+
dtick: 1,
2863+
range: [-18.5, 18.5]
2864+
});
2865+
2866+
expect(textOut).toEqual([
2867+
'10<sup>\u221218</sup>',
2868+
'10<sup>\u221217</sup>',
2869+
'10<sup>\u221216</sup>',
2870+
'1f', '10f', '100f', '1p', '10p', '100p', '1n', '10n', '100n',
2871+
'1μ', '0.00001', '0.0001', '0.001', '0.01', '0.1', '1', '10', '100',
2872+
'1000', '10,000', '100,000', '1M', '10M', '100M', '1G', '10G', '100G',
2873+
'1T', '10T', '100T',
2874+
'10<sup>15</sup>',
2875+
'10<sup>16</sup>',
2876+
'10<sup>17</sup>',
2877+
'10<sup>18</sup>'
2878+
]);
2879+
var textOut = mockCalc({
2880+
type: 'log',
2881+
tickmode: 'linear',
2882+
exponentformat: 'SI',
2883+
minexponent: 0,
2884+
showexponent: 'all',
2885+
tick0: 0,
2886+
dtick: 1,
2887+
range: [-18.5, 18.5]
2888+
});
2889+
2890+
expect(textOut).toEqual([
2891+
'10<sup>\u221218</sup>',
2892+
'10<sup>\u221217</sup>',
2893+
'10<sup>\u221216</sup>',
2894+
'1f', '10f', '100f', '1p', '10p', '100p', '1n', '10n', '100n',
2895+
'1μ', '10μ', '100μ', '1m', '10m', '100m', '1', '10', '100',
2896+
'1k', '10k', '100k', '1M', '10M', '100M', '1G', '10G', '100G',
2897+
'1T', '10T', '100T',
2898+
'10<sup>15</sup>',
2899+
'10<sup>16</sup>',
2900+
'10<sup>17</sup>',
2901+
'10<sup>18</sup>'
2902+
]);
2903+
});
2904+
28542905
it('supports e/E format on log axes', function() {
28552906
['e', 'E'].forEach(function(e) {
28562907
var textOut = mockCalc({

0 commit comments

Comments
 (0)