Skip to content

Commit bc0c5df

Browse files
committed
revised the condition check and added a jasmine test for textpositions
1 parent bb7adb6 commit bc0c5df

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/plot_api/helpers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ function cleanTextPosition(textposition) {
440440
var posY = 'middle',
441441
posX = 'center';
442442

443-
if(typeof textposition === "string") {
443+
if(typeof textposition === 'string') {
444444
if(textposition.indexOf('top') !== -1) posY = 'top';
445445
else if(textposition.indexOf('bottom') !== -1) posY = 'bottom';
446446

test/jasmine/tests/gl3d_plot_interact_test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -567,17 +567,17 @@ describe('Test gl3d plots', function() {
567567
y: [-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16],
568568
z: [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
569569
text: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'],
570-
textposition: ["left top", "right top", "left bottom", "right bottom", null, undefined, , true, false, [], {}, NaN, Infinity, 0]
570+
textposition: ['left top', 'right top', 'left bottom', 'right bottom', null, undefined, true, false, [], {}, NaN, Infinity, 0, 1.2]
571571
}])
572572
.then(function() {
573-
var AllTextpositions = gd._fullData[0].textposition
573+
var AllTextpositions = gd._fullData[0].textposition;
574574

575-
expect(AllTextpositions[0]).toBe("top left", 'is not top left');
576-
expect(AllTextpositions[1]).toBe("top right", 'is not top right');
577-
expect(AllTextpositions[2]).toBe("bottom left", 'is not bottom left');
578-
expect(AllTextpositions[3]).toBe("bottom right", 'is not bottom right');
575+
expect(AllTextpositions[0]).toBe('top left', 'is not top left');
576+
expect(AllTextpositions[1]).toBe('top right', 'is not top right');
577+
expect(AllTextpositions[2]).toBe('bottom left', 'is not bottom left');
578+
expect(AllTextpositions[3]).toBe('bottom right', 'is not bottom right');
579579
for(var i = 4; i < AllTextpositions.length; i++) {
580-
expect(AllTextpositions[i]).toBe("middle center", 'is not middle center');
580+
expect(AllTextpositions[i]).toBe('middle center', 'is not middle center');
581581
}
582582
})
583583
.catch(failTest)

0 commit comments

Comments
 (0)