Skip to content

Commit 984aa46

Browse files
committed
Expect new title syntax in legend, lib and further tests [882]
- Further being splom, validate and template tests.
1 parent 0e144b6 commit 984aa46

File tree

6 files changed

+39
-33
lines changed

6 files changed

+39
-33
lines changed

test/image/mocks/shapes.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"yaxis":"y2"
1313
}],
1414
"layout": {
15-
"xaxis":{"title":"linear","range":[0,1],"domain":[0.35,0.65],"type":"linear","showgrid":false,"zeroline":false,"showticklabels":false},
16-
"yaxis":{"title":"log","range":[0,1],"domain":[0.6,1],"type":"log","showgrid":false,"zeroline":false,"showticklabels":false},
17-
"xaxis2":{"title":"date","range":["2000-01-01","2000-01-02"],"domain":[0.7,1],"anchor":"y2","type":"date","showgrid":false,"zeroline":false,"showticklabels":false},
18-
"yaxis2":{"title":"category","range":[0,1],"domain":[0.6,1],"anchor":"x2","type":"category","showgrid":false,"zeroline":false,"showticklabels":false},
15+
"xaxis":{"title":{"text":"linear"},"range":[0,1],"domain":[0.35,0.65],"type":"linear","showgrid":false,"zeroline":false,"showticklabels":false},
16+
"yaxis":{"title":{"text":"log"},"range":[0,1],"domain":[0.6,1],"type":"log","showgrid":false,"zeroline":false,"showticklabels":false},
17+
"xaxis2":{"title":{"text":"date"},"range":["2000-01-01","2000-01-02"],"domain":[0.7,1],"anchor":"y2","type":"date","showgrid":false,"zeroline":false,"showticklabels":false},
18+
"yaxis2":{"title":{"text":"category"},"range":[0,1],"domain":[0.6,1],"anchor":"x2","type":"category","showgrid":false,"zeroline":false,"showticklabels":false},
1919
"height":400,
2020
"width":800,
2121
"margin": {"l":20,"r":20,"pad":0},

test/jasmine/tests/legend_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ describe('legend interaction', function() {
14311431
});
14321432
gd.on('plotly_relayout', function(d) {
14331433
expect(typeof d).toBe('object');
1434-
expect(d.title).toBe('just clicked on trace #2');
1434+
expect(d.title.text).toBe('just clicked on trace #2');
14351435
done();
14361436
});
14371437
gd.on('plotly_restyle', function() {
@@ -1451,7 +1451,7 @@ describe('legend interaction', function() {
14511451
});
14521452
gd.on('plotly_relayout', function(d) {
14531453
expect(typeof d).toBe('object');
1454-
expect(d.title).toBe('just double clicked on trace #0');
1454+
expect(d.title.text).toBe('just double clicked on trace #0');
14551455
done();
14561456
});
14571457
gd.on('plotly_restyle', function() {

test/jasmine/tests/lib_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2658,7 +2658,7 @@ describe('Queue', function() {
26582658
.then(function() {
26592659
expect(gd.undoQueue.index).toEqual(2);
26602660
expect(gd.undoQueue.queue[1].undo.args[0][1].title).toEqual(null);
2661-
expect(gd.undoQueue.queue[1].redo.args[0][1].title).toEqual('A title');
2661+
expect(gd.undoQueue.queue[1].redo.args[0][1].title.text).toEqual('A title');
26622662

26632663
return Plotly.restyle(gd, 'mode', 'markers');
26642664
})
@@ -2670,7 +2670,7 @@ describe('Queue', function() {
26702670
expect(gd.undoQueue.queue[1].redo.args[0][1].mode).toEqual('markers');
26712671

26722672
expect(gd.undoQueue.queue[0].undo.args[0][1].title).toEqual(null);
2673-
expect(gd.undoQueue.queue[0].redo.args[0][1].title).toEqual('A title');
2673+
expect(gd.undoQueue.queue[0].redo.args[0][1].title.text).toEqual('A title');
26742674

26752675
return Plotly.restyle(gd, 'transforms[0]', { type: 'filter' });
26762676
})

test/jasmine/tests/splom_test.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,10 @@ describe('Test splom trace defaults:', function() {
325325
});
326326

327327
var fullLayout = gd._fullLayout;
328-
expect(fullLayout.xaxis.title).toBe('A');
329-
expect(fullLayout.yaxis.title).toBe('A');
330-
expect(fullLayout.xaxis2.title).toBe('B');
331-
expect(fullLayout.yaxis2.title).toBe('B');
328+
expect(fullLayout.xaxis.title.text).toBe('A');
329+
expect(fullLayout.yaxis.title.text).toBe('A');
330+
expect(fullLayout.xaxis2.title.text).toBe('B');
331+
expect(fullLayout.yaxis2.title.text).toBe('B');
332332
});
333333

334334
it('should set axis title default using dimensions *label* (even visible false dimensions)', function() {
@@ -346,12 +346,12 @@ describe('Test splom trace defaults:', function() {
346346
});
347347

348348
var fullLayout = gd._fullLayout;
349-
expect(fullLayout.xaxis.title).toBe('A');
350-
expect(fullLayout.yaxis.title).toBe('A');
351-
expect(fullLayout.xaxis2.title).toBe('B');
352-
expect(fullLayout.yaxis2.title).toBe('B');
353-
expect(fullLayout.xaxis3.title).toBe('C');
354-
expect(fullLayout.yaxis3.title).toBe('C');
349+
expect(fullLayout.xaxis.title.text).toBe('A');
350+
expect(fullLayout.yaxis.title.text).toBe('A');
351+
expect(fullLayout.xaxis2.title.text).toBe('B');
352+
expect(fullLayout.yaxis2.title.text).toBe('B');
353+
expect(fullLayout.xaxis3.title.text).toBe('C');
354+
expect(fullLayout.yaxis3.title.text).toBe('C');
355355
});
356356

357357
it('should ignore (x|y)axes values beyond dimensions length', function() {
@@ -382,12 +382,12 @@ describe('Test splom trace defaults:', function() {
382382
'x2y', 'x2y2', 'x2y3',
383383
'x3y', 'x3y2', 'x3y3'
384384
]);
385-
expect(fullLayout.xaxis.title).toBe('A');
386-
expect(fullLayout.yaxis.title).toBe('A');
387-
expect(fullLayout.xaxis2.title).toBe('B');
388-
expect(fullLayout.yaxis2.title).toBe('B');
389-
expect(fullLayout.xaxis3.title).toBe('C');
390-
expect(fullLayout.yaxis3.title).toBe('C');
385+
expect(fullLayout.xaxis.title.text).toBe('A');
386+
expect(fullLayout.yaxis.title.text).toBe('A');
387+
expect(fullLayout.xaxis2.title.text).toBe('B');
388+
expect(fullLayout.yaxis2.title.text).toBe('B');
389+
expect(fullLayout.xaxis3.title.text).toBe('C');
390+
expect(fullLayout.yaxis3.title.text).toBe('C');
391391
expect(fullLayout.xaxis4).toBe(undefined);
392392
expect(fullLayout.yaxis4).toBe(undefined);
393393
});
@@ -422,12 +422,12 @@ describe('Test splom trace defaults:', function() {
422422
]);
423423
expect(fullLayout.xaxis).toBe(undefined);
424424
expect(fullLayout.yaxis).toBe(undefined);
425-
expect(fullLayout.xaxis2.title).toBe('A');
426-
expect(fullLayout.yaxis2.title).toBe('A');
427-
expect(fullLayout.xaxis3.title).toBe('B');
428-
expect(fullLayout.yaxis3.title).toBe('B');
429-
expect(fullLayout.xaxis4.title).toBe('C');
430-
expect(fullLayout.yaxis4.title).toBe('C');
425+
expect(fullLayout.xaxis2.title.text).toBe('A');
426+
expect(fullLayout.yaxis2.title.text).toBe('A');
427+
expect(fullLayout.xaxis3.title.text).toBe('B');
428+
expect(fullLayout.yaxis3.title.text).toBe('B');
429+
expect(fullLayout.xaxis4.title.text).toBe('C');
430+
expect(fullLayout.yaxis4.title.text).toBe('C');
431431
expect(fullLayout.xaxis5).toBe(undefined);
432432
expect(fullLayout.yaxis5).toBe(undefined);
433433
});

test/jasmine/tests/template_test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ describe('makeTemplate', function() {
158158
{fill: 'toself'}
159159
] },
160160
layout: {
161-
title: 'Fill toself and tonext',
161+
title: {
162+
text: 'Fill toself and tonext'
163+
},
162164
width: 400,
163165
height: 400
164166
}

test/jasmine/tests/validate_test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ describe('Plotly.validate', function() {
1818
type: 'scatter',
1919
x: [1, 2, 3]
2020
}], {
21-
title: 'my simple graph'
21+
title: {
22+
text: 'my simple graph'
23+
}
2224
});
2325

2426
expect(out).toBeUndefined();
@@ -371,7 +373,9 @@ describe('Plotly.validate', function() {
371373
}]
372374
}),
373375
], {
374-
title: 'my transformed graph'
376+
title: {
377+
text: 'my transformed graph'
378+
}
375379
});
376380

377381
expect(out.length).toEqual(5);

0 commit comments

Comments
 (0)