Skip to content

Commit 7d5a063

Browse files
committed
test: replace substr with substring in test files
1 parent fe936c7 commit 7d5a063

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

test/jasmine/tests/annotations_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ describe('annotation effects', function() {
12891289
// AJ loosened this test - expected '2017-02-02 06:36:46.8112'
12901290
// but when I run it I get '2017-02-02 06:28:39.9586'.
12911291
// must be different fonts altering autoranging
1292-
expect(gd._fullLayout.annotations[0].y.substr(0, 10)).toBe('2017-02-02');
1292+
expect(gd._fullLayout.annotations[0].y.substring(0, 10)).toBe('2017-02-02');
12931293
})
12941294
.then(done, done.fail);
12951295
});

test/jasmine/tests/axes_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ describe('Test axes', function() {
833833
it('breaks scaleanchor loops and drops conflicting ratios', function() {
834834
var warnings = [];
835835
spyOn(Lib, 'warn').and.callFake(function(msg) {
836-
warnings.push(msg.substr(0, msg.indexOf(' to avoid')));
836+
warnings.push(msg.substring(0, msg.indexOf(' to avoid')));
837837
});
838838

839839
layoutIn = {
@@ -868,7 +868,7 @@ describe('Test axes', function() {
868868
it('silently drops invalid scaleanchor values', function() {
869869
var warnings = [];
870870
spyOn(Lib, 'warn').and.callFake(function(msg) {
871-
warnings.push(msg.substr(0, msg.indexOf(' to avoid')));
871+
warnings.push(msg.substring(0, msg.indexOf(' to avoid')));
872872
});
873873

874874
layoutIn = {

test/jasmine/tests/bar_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2170,7 +2170,7 @@ describe('A bar plot', function() {
21702170

21712171
function getArea(path) {
21722172
var pos = path
2173-
.substr(1, path.length - 2)
2173+
.substring(1, path.length - 1)
21742174
.replace('V', ',')
21752175
.replace('H', ',')
21762176
.replace('V', ',')

test/jasmine/tests/lib_date_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ describe('dates', function() {
261261
for(var i = -1; i <= 1; i += 0.001) {
262262
var tenths = Math.round(i * 10);
263263
var base = i < -0.05 ? '1969-12-31 23:59:59.99' : '1970-01-01 00:00:00.00';
264-
var expected = (base + String(tenths + 200).substr(1))
264+
var expected = (base + String(tenths + 200).substring(1))
265265
.replace(/0+$/, '')
266266
.replace(/ 00:00:00[\.]$/, '');
267267
expect(Lib.ms2DateTime(i)).toBe(expected, i);

test/jasmine/tests/modebar_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ describe('ModeBar', function() {
10401040
var actual = ax.range;
10411041

10421042
if(ax.type === 'date') {
1043-
var truncate = function(v) { return v.substr(0, 10); };
1043+
var truncate = function(v) { return v.substring(0, 10); };
10441044
expect(actual.map(truncate)).toEqual(expected.map(truncate), axName);
10451045
} else {
10461046
expect(actual).toBeCloseToArray(expected, PRECISION, axName);

test/jasmine/tests/shapes_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,7 @@ describe('Test shapes', function() {
16421642
var xParams = constants.paramIsX[segmentType];
16431643
var yParams = constants.paramIsY[segmentType];
16441644
var nParams = constants.numParams[segmentType];
1645-
var params = segment.substr(1).match(constants.paramRE);
1645+
var params = segment.substring(1).match(constants.paramRE);
16461646

16471647
if(params) {
16481648
params.forEach(function(param) {

test/jasmine/tests/snapshot_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ describe('Plotly.Snapshot', function() {
252252
describe('should handle quoted style properties', function() {
253253
function checkURL(actual, msg) {
254254
// which is enough tot check that toSVG did its job right
255-
expect((actual || '').substr(0, 6)).toBe('url(\"#', msg);
255+
expect((actual || '').substring(0, 6)).toBe('url(\"#', msg);
256256
}
257257

258258
it('- marker-gradient case', function(done) {

test/jasmine/tests/toimage_test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,12 @@ describe('Plotly.toImage', function() {
247247
var clipPath = gSubplot.getAttribute('clip-path');
248248
var len = clipPath.length;
249249

250-
var head = clipPath.substr(0, 4);
251-
var tail = clipPath.substr(len - 7, len);
250+
var head = clipPath.substring(0, 4);
251+
var tail = clipPath.substring(len - 7, len);
252252
expect(head).toBe('url(', 'subplot clipPath head');
253253
expect(tail).toBe('xyplot)', 'subplot clipPath tail');
254254

255-
var middle = clipPath.substr(4, 10);
255+
var middle = clipPath.substring(4, 14);
256256
expect(middle.length).toBe(10, 'subplot clipPath uid length');
257257
expect(middle.indexOf('http://')).toBe(-1, 'no <base> URL in subplot clipPath!');
258258
expect(middle.indexOf('https://')).toBe(-1, 'no <base> URL in subplot clipPath!');

0 commit comments

Comments
 (0)