Skip to content

Commit 97dc399

Browse files
committed
Add tests for color.fill and color.stroke
1 parent 50d26bc commit 97dc399

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/snapshot/tosvg.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ module.exports = function toSVG(gd, format) {
105105
}
106106
}
107107

108-
// remove draglayer (it's invisible anyways!)
108+
// remove draglayer for Adobe Illustrator compatibility
109109
if(fullLayout._draggers) {
110110
fullLayout._draggers.node().remove();
111111
}

test/jasmine/tests/color_test.js

+30
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,34 @@ describe('Test color:', function() {
145145
expect(container2).toEqual(expectedContainer2);
146146
});
147147
});
148+
149+
describe('fill', function() {
150+
151+
it('should call style with both fill and fill-opacity', function() {
152+
var mockElement = {
153+
style: function(object) {
154+
expect(object.fill).toBe('rgb(255, 255, 0)');
155+
expect(object['fill-opacity']).toBe(0.5);
156+
}
157+
};
158+
159+
Color.fill(mockElement, 'rgba(255,255,0,0.5');
160+
});
161+
162+
});
163+
164+
describe('stroke', function() {
165+
166+
it('should call style with both fill and fill-opacity', function() {
167+
var mockElement = {
168+
style: function(object) {
169+
expect(object.stroke).toBe('rgb(255, 255, 0)');
170+
expect(object['stroke-opacity']).toBe(0.5);
171+
}
172+
};
173+
174+
Color.stroke(mockElement, 'rgba(255,255,0,0.5');
175+
});
176+
177+
});
148178
});

0 commit comments

Comments
 (0)