@@ -65,11 +65,21 @@ module.exports = function checkTextTemplate(mock, selector, tests) {
65
65
}
66
66
tests . push ( [ '%{meta.colname}' , metaSolution ] ) ;
67
67
68
+ // Make sure that empty text shows up as an empty string
69
+ var emptyTextMock = Lib . extendDeep ( [ ] , mock ) ;
70
+ var emptyTextSolution = [ ] ;
71
+ emptyTextMock [ 0 ] . text = [ ] ;
72
+ for ( i = 0 ; i < N ; i ++ ) {
73
+ emptyTextMock [ 0 ] . text [ i ] = '' ;
74
+ emptyTextSolution [ i ] = 'text:' ;
75
+ }
76
+ tests . push ( [ 'text:%{text}' , emptyTextSolution , emptyTextMock ] ) ;
77
+
68
78
if ( isGL ) {
69
79
tests . forEach ( function ( test ) {
70
80
it ( '@gl should support texttemplate' , function ( done ) {
71
81
var gd = createGraphDiv ( ) ;
72
- var mockCopy = Lib . extendDeep ( [ ] , mock ) ;
82
+ var mockCopy = Lib . extendDeep ( [ ] , test [ 2 ] || mock ) ;
73
83
mockCopy [ 0 ] . texttemplate = test [ 0 ] ;
74
84
Plotly . newPlot ( gd , mockCopy )
75
85
. then ( function ( ) {
@@ -101,7 +111,7 @@ module.exports = function checkTextTemplate(mock, selector, tests) {
101
111
tests . forEach ( function ( test ) {
102
112
it ( 'should support texttemplate' , function ( done ) {
103
113
var gd = createGraphDiv ( ) ;
104
- var mockCopy = Lib . extendDeep ( [ ] , mock ) ;
114
+ var mockCopy = Lib . extendDeep ( [ ] , test [ 2 ] || mock ) ;
105
115
mockCopy [ 0 ] . texttemplate = test [ 0 ] ;
106
116
Plotly . newPlot ( gd , mockCopy )
107
117
. then ( function ( ) {
0 commit comments