few bug fixes to getCSS and unit tests

This commit is contained in:
MoyuScript
2012-03-04 21:16:18 +02:00
parent f84a3033bf
commit c434fdf6cf
4 changed files with 29 additions and 13 deletions

View File

@ -22,7 +22,7 @@
<script type="text/javascript" src="../../src/renderers/Canvas.js"></script>
<script src="unit/css.js"></script>
<script src="unit/utils.js"></script>
<!-- <script src="unit/utils.js"></script> -->
<style>
#borders div {

View File

@ -1,8 +1,9 @@
// declare vars (preventing JSHint messages)
/* this breaks the testing for IE<9, haven't really looked into why
var test = test || function(){},
QUnit = QUnit || {},
_html2canvas = _html2canvas || {};
*/
module("CSS");
$(function() {
@ -153,9 +154,15 @@ $(function() {
$('#backgroundGradients div').each(function(i, el) {
$.each(propsToTest['background-gradient'], function(s, prop) {
var src, img, canvas, ctx, id, data, len, red, green, blue, overallColor = 0;
src = _html2canvas.Util.getCSS(el, prop),
src = _html2canvas.Util.getCSS(el, prop);
if (!/^(-webkit|-o|-moz|-ms|linear)-/.test( src )) {
ok(true);
} else {
img = _html2canvas.Generate.Gradient(src, {
width: 50,
height: 50
@ -183,6 +190,7 @@ $(function() {
overallColor /= (len / 4);
QUnit.notEqual(overallColor, 255, 'No Background Gradient - CSS was ' + src);
}
});
});
});