Fix some unit tests

This commit is contained in:
Juriy Zaytsev 2015-12-24 11:22:00 -05:00
parent 5d0524a6bd
commit 8c2a882e64
2 changed files with 8 additions and 9 deletions

View file

@ -1,6 +1,5 @@
language: node_js
node_js:
- "4"
- "0.12"
- "0.11"
- "0.10"

View file

@ -427,7 +427,7 @@
});
test('fill-opacity attribute with fill attribute', function() {
var el = fabric.document.createElement(rect);
var el = fabric.document.createElement('rect');
var opacityValue = Math.random().toFixed(2);
el.setAttribute('fill-opacity', opacityValue);
@ -435,22 +435,22 @@
var obj = fabric.Rect.fromElement(el);
equal(obj.fill, 'rgba(255,0,0,' + parseFloat(opacityValue) * 255 + ')',
'opacity should be parsed correctly from "opacity" attribute of ' + tagNames[i] + ' element');
'opacity should be parsed correctly from "opacity" attribute of rect element');
});
test('fill-opacity attribute without fill attribute', function() {
var el = fabric.document.createElement(rect);
var el = fabric.document.createElement('rect');
var opacityValue = Math.random().toFixed(2);
el.setAttribute('fill-opacity', opacityValue);
var obj = fabric.Rect.fromElement(el);
equal(obj.fill, 'rgba(0,0,0,' + parseFloat(opacityValue) * 255 + ')',
'opacity should be parsed correctly from "opacity" attribute of ' + tagNames[i] + ' element');
'opacity should be parsed correctly from "opacity" attribute of rect element');
});
test('stroke-opacity attribute with fill attribute', function() {
var el = fabric.document.createElement(rect);
var el = fabric.document.createElement('rect');
var opacityValue = Math.random().toFixed(2);
el.setAttribute('fill-opacity', opacityValue);
@ -458,18 +458,18 @@
var obj = fabric.Rect.fromElement(el);
equal(obj.fill, 'rgba(255,0,0,' + parseFloat(opacityValue) * 255 + ')',
'opacity should be parsed correctly from "opacity" attribute of ' + tagNames[i] + ' element');
'opacity should be parsed correctly from "opacity" attribute of rect element');
});
test('stroke-opacity attribute without fill attribute', function() {
var el = fabric.document.createElement(rect);
var el = fabric.document.createElement('rect');
var opacityValue = Math.random().toFixed(2);
el.setAttribute('fill-opacity', opacityValue);
var obj = fabric.Rect.fromElement(el);
equal(obj.fill, 'rgba(0,0,0,' + parseFloat(opacityValue) * 255 + ')',
'opacity should be parsed correctly from "opacity" attribute of ' + tagNames[i] + ' element');
'opacity should be parsed correctly from "opacity" attribute of rect element');
});
test('getCssRule', function() {