File tree Expand file tree Collapse file tree 2 files changed +44
-3
lines changed Expand file tree Collapse file tree 2 files changed +44
-3
lines changed Original file line number Diff line number Diff line change @@ -298,9 +298,7 @@ plots.addLinks = function(gd) {
298298 // IE doesn't like getComputedTextLength if an element
299299 // isn't visible, which it (sometimes?) isn't
300300 // apparently offsetParent is null for invisibles.
301- // http://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom
302- if ( text && text . offsetParent &&
303- text . getComputedTextLength ( ) >= ( fullLayout . width - 20 ) ) {
301+ if ( text && text . getComputedTextLength ( ) >= ( fullLayout . width - 20 ) ) {
304302 // Align the text at the left
305303 attrs [ 'text-anchor' ] = 'start' ;
306304 attrs . x = 5 ;
Original file line number Diff line number Diff line change 1+ var Plotly = require ( '@src/plotly' ) ;
2+ var createGraphDiv = require ( '../assets/create_graph_div' ) ;
3+ var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
4+
5+ describe ( 'config argument' , function ( ) {
6+
7+ var gd ;
8+
9+ beforeEach ( function ( done ) {
10+ gd = createGraphDiv ( ) ;
11+ done ( ) ;
12+ } ) ;
13+
14+ afterEach ( destroyGraphDiv ) ;
15+
16+ describe ( 'showLink attribute' , function ( ) {
17+
18+ it ( 'should not display the edit link by default' , function ( ) {
19+ Plotly . plot ( gd , [ ] , { } ) ;
20+
21+ var link = document . getElementsByClassName ( 'js-plot-link-container' ) [ 0 ] ;
22+
23+ expect ( link . textContent ) . toBe ( '' ) ;
24+
25+ var bBox = link . getBoundingClientRect ( ) ;
26+ expect ( bBox . width ) . toBe ( 0 ) ;
27+ expect ( bBox . height ) . toBe ( 0 ) ;
28+ } ) ;
29+
30+ it ( 'should display a link when true' , function ( ) {
31+ Plotly . plot ( gd , [ ] , { } , { showLink : true } ) ;
32+
33+ var link = document . getElementsByClassName ( 'js-plot-link-container' ) [ 0 ] ;
34+
35+ console . log ( link ) ;
36+ expect ( link . textContent ) . toBe ( 'Edit chart »' ) ;
37+
38+ var bBox = link . getBoundingClientRect ( ) ;
39+ expect ( bBox . width ) . toBeGreaterThan ( 0 ) ;
40+ expect ( bBox . height ) . toBeGreaterThan ( 0 ) ;
41+ } ) ;
42+ } ) ;
43+ } ) ;
You can’t perform that action at this time.
0 commit comments