Skip to content

Commit 84d5c7d

Browse files
committed
add jasmine tests
1 parent 9ebb1af commit 84d5c7d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/jasmine/tests/bar_test.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,46 @@ describe('Bar.supplyDefaults', function() {
217217
expect(traceOut.insidetextfont.size).toBe(20);
218218
});
219219

220+
it('should set cliponaxis to false when text has value and textposition is outside', function() {
221+
traceIn = {
222+
y: [1, 2, 3],
223+
text: ['A', 'B', 'C'],
224+
textposition: 'outside'
225+
};
226+
supplyDefaults(traceIn, traceOut, defaultColor, {});
227+
expect(traceOut.cliponaxis).toBe(false);
228+
});
229+
230+
it('should set cliponaxis to default (true) when text is not provided', function() {
231+
traceIn = {
232+
y: [1, 2, 3],
233+
textposition: 'outside'
234+
};
235+
supplyDefaults(traceIn, traceOut, defaultColor, {});
236+
expect(traceOut.cliponaxis).toBe(true);
237+
});
238+
239+
it('should set cliponaxis to default (true) when textposition is not outside', function() {
240+
traceIn = {
241+
y: [1, 2, 3],
242+
text: ['A', 'B', 'C'],
243+
textposition: 'inside'
244+
};
245+
supplyDefaults(traceIn, traceOut, defaultColor, {});
246+
expect(traceOut.cliponaxis).toBe(true);
247+
});
248+
249+
it('should respect explicit cliponaxis setting even with text and outside position', function() {
250+
traceIn = {
251+
y: [1, 2, 3],
252+
text: ['A', 'B', 'C'],
253+
textposition: 'outside',
254+
cliponaxis: true
255+
};
256+
supplyDefaults(traceIn, traceOut, defaultColor, {});
257+
expect(traceOut.cliponaxis).toBe(true);
258+
});
259+
220260
it('should inherit layout.calendar', function() {
221261
traceIn = {
222262
x: [1, 2, 3],

0 commit comments

Comments
 (0)