Skip to content

Commit 10ee3d1

Browse files
authored
Merge pull request #5370 from plotly/use-newPlot-in-tests
Make tests less dependant on Plotly.plot calls
2 parents 446123c + 095c51e commit 10ee3d1

File tree

92 files changed

+1206
-1206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1206
-1206
lines changed

test/jasmine/tests/animate_test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ describe('Test animate API', function() {
104104
return Promise.resolve().then(delay(arguments[5].duration));
105105
});
106106

107-
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(function() {
107+
Plotly.newPlot(gd, mockCopy.data, mockCopy.layout).then(function() {
108108
return Plotly.addFrames(gd, mockCopy.frames);
109109
}).then(done);
110110
});
@@ -598,7 +598,7 @@ describe('Animate API details', function() {
598598
beforeEach(function(done) {
599599
gd = createGraphDiv();
600600
mockCopy = Lib.extendDeep({}, mock);
601-
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(done);
601+
Plotly.newPlot(gd, mockCopy.data, mockCopy.layout).then(done);
602602
});
603603

604604
afterEach(function() {
@@ -720,7 +720,7 @@ describe('Animating multiple axes', function() {
720720
});
721721

722722
it('updates ranges of secondary axes', function(done) {
723-
Plotly.plot(gd, [
723+
Plotly.newPlot(gd, [
724724
{y: [1, 2, 3]},
725725
{y: [1, 2, 3], yaxis: 'y2'}
726726
], {
@@ -751,7 +751,7 @@ describe('Animating multiple axes', function() {
751751
});
752752

753753
it('updates ranges of secondary axes (date + category case)', function(done) {
754-
Plotly.plot(gd, [
754+
Plotly.newPlot(gd, [
755755
{x: ['2018-01-01', '2019-01-01', '2020-01-01'], y: [1, 2, 3]},
756756
{x: ['a', 'b', 'c'], y: [1, 2, 3], xaxis: 'x2', yaxis: 'y2'}
757757
], {
@@ -818,7 +818,7 @@ describe('Animating multiple axes', function() {
818818
};
819819
}
820820

821-
Plotly.plot(gd, [{
821+
Plotly.newPlot(gd, [{
822822
x: [0.1, 0.2, 0.3],
823823
y: [0.4, 0.5, 0.6],
824824
}, {
@@ -882,7 +882,7 @@ describe('non-animatable fallback', function() {
882882
});
883883

884884
it('falls back to a simple update for bar graphs', function(done) {
885-
Plotly.plot(gd, [{
885+
Plotly.newPlot(gd, [{
886886
x: [1, 2, 3],
887887
y: [4, 5, 6],
888888
type: 'bar'
@@ -913,7 +913,7 @@ describe('animating scatter traces', function() {
913913

914914
it('animates trace opacity', function(done) {
915915
var trace;
916-
Plotly.plot(gd, [{
916+
Plotly.newPlot(gd, [{
917917
x: [1, 2, 3],
918918
y: [4, 5, 6],
919919
opacity: 1
@@ -931,7 +931,7 @@ describe('animating scatter traces', function() {
931931
});
932932

933933
it('computes calcdata correctly when transforms are present', function(done) {
934-
Plotly.plot(gd, {
934+
Plotly.newPlot(gd, {
935935
data: [{
936936
x: [1, 2, 3],
937937
y: [1, 2, 3],
@@ -971,7 +971,7 @@ describe('animating scatter traces', function() {
971971
.map(Number);
972972
}
973973

974-
Plotly.plot(gd, [{
974+
Plotly.newPlot(gd, [{
975975
y: [1, 2, 1]
976976
}, {
977977
type: 'bar',

test/jasmine/tests/annotations_test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ describe('annotations relayout', function() {
187187
expect(typeof MathJax).toBe('undefined');
188188
mockLayout.annotations[14].text = '$x+y+z$';
189189

190-
Plotly.plot(gd, mockData, mockLayout)
190+
Plotly.newPlot(gd, mockData, mockLayout)
191191
.then(function() {
192192
spyOn(Loggers, 'warn');
193193

@@ -512,7 +512,7 @@ describe('annotations log/linear axis changes', function() {
512512
var mockData = Lib.extendDeep([], mock.data);
513513
var mockLayout = Lib.extendDeep({}, mock.layout);
514514

515-
Plotly.plot(gd, mockData, mockLayout).then(done);
515+
Plotly.newPlot(gd, mockData, mockLayout).then(done);
516516
});
517517

518518
afterEach(destroyGraphDiv);
@@ -667,7 +667,7 @@ describe('annotations autorange', function() {
667667
}
668668

669669
it('should adapt to relayout calls', function(done) {
670-
Plotly.plot(gd, mock).then(function() {
670+
Plotly.newPlot(gd, mock).then(function() {
671671
assertRanges(
672672
[0.91, 2.09], [0.91, 2.09],
673673
['2000-11-13', '2001-04-21'], [-0.069, 3.917],
@@ -756,7 +756,7 @@ describe('annotations autorange', function() {
756756
});
757757

758758
it('catches bad xref/yref', function(done) {
759-
Plotly.plot(gd, mock).then(function() {
759+
Plotly.newPlot(gd, mock).then(function() {
760760
return Plotly.relayout(gd, {'annotations[1]': {
761761
text: 'LT',
762762
x: -1,
@@ -787,7 +787,7 @@ describe('annotations autorange', function() {
787787
expect(fullLayout.yaxis.range).toBeCloseToArray(yrng, 1, msg + ' yrng');
788788
}
789789

790-
Plotly.plot(gd, [{y: [1, 2]}], {
790+
Plotly.newPlot(gd, [{y: [1, 2]}], {
791791
xaxis: {range: [0, 2]},
792792
yaxis: {range: [0, 2]},
793793
annotations: [{
@@ -818,7 +818,7 @@ describe('annotations autorange', function() {
818818
});
819819

820820
it('should not error out on subplots w/o visible traces', function(done) {
821-
Plotly.plot(gd, [{}], {
821+
Plotly.newPlot(gd, [{}], {
822822
annotations: [{
823823
x: 0.1,
824824
y: 0.1,
@@ -931,7 +931,7 @@ describe('annotation clicktoshow', function() {
931931

932932
it('should select only clicktoshow annotations matching x, y, and axes of any point', function(done) {
933933
// first try to select without adding clicktoshow, both visible and invisible
934-
Plotly.plot(gd, data, layout())
934+
Plotly.newPlot(gd, data, layout())
935935
// clicktoshow is off initially, so it doesn't *expect* clicking will
936936
// do anything, and it doesn't *actually* do anything.
937937
.then(clickAndCheck({newPts: [[1, 2]], newCTS: false, on: allIndices, step: 1}))
@@ -968,7 +968,7 @@ describe('annotation clicktoshow', function() {
968968
});
969969

970970
it('works on date and log axes', function(done) {
971-
Plotly.plot(gd, [{
971+
Plotly.newPlot(gd, [{
972972
x: ['2016-01-01', '2016-01-02', '2016-01-03'],
973973
y: [1, 1, 3]
974974
}], {
@@ -992,7 +992,7 @@ describe('annotation clicktoshow', function() {
992992
});
993993

994994
it('works on category axes', function(done) {
995-
Plotly.plot(gd, [{
995+
Plotly.newPlot(gd, [{
996996
x: ['a', 'b', 'c'],
997997
y: [1, 2, 3]
998998
}], {
@@ -1039,7 +1039,7 @@ describe('annotation effects', function() {
10391039
// we've already tested autorange with relayout, so fix the geometry
10401040
// completely so we know exactly what we're dealing with
10411041
// plot area is 300x300, and covers data range 100x100
1042-
return Plotly.plot(gd,
1042+
return Plotly.newPlot(gd,
10431043
[{x: [0, 100], y: [0, 100], mode: 'markers'}],
10441044
{
10451045
xaxis: {range: [0, 100]},
@@ -1635,7 +1635,7 @@ describe('annotation effects', function() {
16351635
};
16361636
}
16371637

1638-
Plotly.plot(gd, [{
1638+
Plotly.newPlot(gd, [{
16391639
x: [0, 1, 2, 3, 4, 5, 6, 7, 8],
16401640
y: [0, 4, 5, 1, 2, 2, 3, 4, 2],
16411641
}], {
@@ -1719,7 +1719,7 @@ describe('animating annotations', function() {
17191719
});
17201720
}
17211721

1722-
Plotly.plot(gd,
1722+
Plotly.newPlot(gd,
17231723
[{y: [1, 2, 3]}],
17241724
{
17251725
annotations: [{text: 'hello'}],

0 commit comments

Comments
 (0)