Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tests less dependant on Plotly.plot calls #5370

Merged
merged 1 commit into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions test/jasmine/tests/animate_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('Test animate API', function() {
return Promise.resolve().then(delay(arguments[5].duration));
});

Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(function() {
Plotly.newPlot(gd, mockCopy.data, mockCopy.layout).then(function() {
return Plotly.addFrames(gd, mockCopy.frames);
}).then(done);
});
Expand Down Expand Up @@ -598,7 +598,7 @@ describe('Animate API details', function() {
beforeEach(function(done) {
gd = createGraphDiv();
mockCopy = Lib.extendDeep({}, mock);
Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(done);
Plotly.newPlot(gd, mockCopy.data, mockCopy.layout).then(done);
});

afterEach(function() {
Expand Down Expand Up @@ -720,7 +720,7 @@ describe('Animating multiple axes', function() {
});

it('updates ranges of secondary axes', function(done) {
Plotly.plot(gd, [
Plotly.newPlot(gd, [
{y: [1, 2, 3]},
{y: [1, 2, 3], yaxis: 'y2'}
], {
Expand Down Expand Up @@ -751,7 +751,7 @@ describe('Animating multiple axes', function() {
});

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

Plotly.plot(gd, [{
Plotly.newPlot(gd, [{
x: [0.1, 0.2, 0.3],
y: [0.4, 0.5, 0.6],
}, {
Expand Down Expand Up @@ -882,7 +882,7 @@ describe('non-animatable fallback', function() {
});

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

it('animates trace opacity', function(done) {
var trace;
Plotly.plot(gd, [{
Plotly.newPlot(gd, [{
x: [1, 2, 3],
y: [4, 5, 6],
opacity: 1
Expand All @@ -931,7 +931,7 @@ describe('animating scatter traces', function() {
});

it('computes calcdata correctly when transforms are present', function(done) {
Plotly.plot(gd, {
Plotly.newPlot(gd, {
data: [{
x: [1, 2, 3],
y: [1, 2, 3],
Expand Down Expand Up @@ -971,7 +971,7 @@ describe('animating scatter traces', function() {
.map(Number);
}

Plotly.plot(gd, [{
Plotly.newPlot(gd, [{
y: [1, 2, 1]
}, {
type: 'bar',
Expand Down
24 changes: 12 additions & 12 deletions test/jasmine/tests/annotations_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe('annotations relayout', function() {
expect(typeof MathJax).toBe('undefined');
mockLayout.annotations[14].text = '$x+y+z$';

Plotly.plot(gd, mockData, mockLayout)
Plotly.newPlot(gd, mockData, mockLayout)
.then(function() {
spyOn(Loggers, 'warn');

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

Plotly.plot(gd, mockData, mockLayout).then(done);
Plotly.newPlot(gd, mockData, mockLayout).then(done);
});

afterEach(destroyGraphDiv);
Expand Down Expand Up @@ -667,7 +667,7 @@ describe('annotations autorange', function() {
}

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

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

Plotly.plot(gd, [{y: [1, 2]}], {
Plotly.newPlot(gd, [{y: [1, 2]}], {
xaxis: {range: [0, 2]},
yaxis: {range: [0, 2]},
annotations: [{
Expand Down Expand Up @@ -818,7 +818,7 @@ describe('annotations autorange', function() {
});

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

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

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

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

Plotly.plot(gd, [{
Plotly.newPlot(gd, [{
x: [0, 1, 2, 3, 4, 5, 6, 7, 8],
y: [0, 4, 5, 1, 2, 2, 3, 4, 2],
}], {
Expand Down Expand Up @@ -1719,7 +1719,7 @@ describe('animating annotations', function() {
});
}

Plotly.plot(gd,
Plotly.newPlot(gd,
[{y: [1, 2, 3]}],
{
annotations: [{text: 'hello'}],
Expand Down
Loading