Skip to content

Commit fe936c7

Browse files
committed
refactor: replace remaining substr in test files
Fixed remaining deprecated substr() calls in build/test files: - test/strict-d3.js - test/jasmine/assets/domain_ref_components.js - test/jasmine/bundle_tests/no_webgl_test.js - test/jasmine/assets/custom_assertions.js - test/jasmine/bundle_tests/plotschema_test.js Excluded stackgl_modules as requested.
1 parent 5002d4f commit fe936c7

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

test/jasmine/assets/custom_assertions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ exports.assertClip = function(sel, isClipped, size, msg) {
226226
var clipPath = d3Select(this).attr('clip-path');
227227

228228
if(isClipped) {
229-
expect(String(clipPath).substr(0, 4))
229+
expect(String(clipPath).slice(0, 4))
230230
.toBe('url(', msg + ' clip path ' + '(item ' + i + ')');
231231
} else {
232232
expect(clipPath)

test/jasmine/assets/domain_ref_components.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,8 @@ function testShapeCombo(combo, assert, gd) {
586586
var xaroPos = combo[3];
587587
var yaroPos = combo[4];
588588
var shapeType = combo[5];
589-
var xAxNum = axispair[0].substr(1);
590-
var yAxNum = axispair[1].substr(1);
589+
var xAxNum = axispair[0].slice(1);
590+
var yAxNum = axispair[1].slice(1);
591591
return Plotly.newPlot(gd, Lib.extendDeep({}, testMock))
592592
.then(function(gd) {
593593
return shapeTest(gd,

test/jasmine/bundle_tests/no_webgl_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('Plotly w/o WebGL support:', function() {
1919
function checkNoWebGLMsg(visible) {
2020
var msg = gd.querySelector('div.no-webgl > p');
2121
if(visible) {
22-
expect(msg.innerHTML.substr(0, 22)).toBe('WebGL is not supported');
22+
expect(msg.innerHTML.slice(0, 22)).toBe('WebGL is not supported');
2323
} else {
2424
expect(msg).toBe(null);
2525
}

test/jasmine/bundle_tests/plotschema_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ describe('plot schema', function() {
172172
);
173173

174174
var name = np.parts[np.parts.length - 1];
175-
var itemName = name.substr(0, name.length - 1);
175+
var itemName = name.slice(0, name.length - 1);
176176

177177
var itemsObj = np.get().items;
178178
var itemObj = itemsObj[itemName];

test/strict-d3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function checkStyleVal(sel, key, val) {
7171
// test each part separately
7272
val.split(/[, ]/g).forEach(function(valPart) {
7373
var pxSplit = valPart.length - 2;
74-
if(valPart.substr(pxSplit) === 'px' && !isNumeric(valPart.substr(0, pxSplit))) {
74+
if(valPart.slice(pxSplit) === 'px' && !isNumeric(valPart.slice(0, pxSplit))) {
7575
throw new Error('d3 selection.style called with value: ' + val);
7676
}
7777
});

0 commit comments

Comments
 (0)