mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
rewrite "less" test to work when deployed
This commit is contained in:
@@ -1,20 +1,23 @@
|
||||
|
||||
Tinytest.add("less - presence", function(test) {
|
||||
|
||||
// find the .less stylesheet, whose first rule contains "less-tests"
|
||||
// in the selector
|
||||
var sheet = _.find(document.styleSheets, function(sh) {
|
||||
var rules = sh.cssRules || sh.rules;
|
||||
return /less-tests/.test(rules[0].selectorText);
|
||||
});
|
||||
var div = document.createElement("DIV");
|
||||
div.style.height = '0';
|
||||
div.style.overflow = 'hidden';
|
||||
div.innerHTML = '<p class="unlucky-left-border"></p>';
|
||||
document.body.appendChild(div);
|
||||
|
||||
test.isTrue(sheet);
|
||||
var p = div.firstChild;
|
||||
var leftBorder;
|
||||
if (p.currentStyle) { // IE
|
||||
leftBorder = p.currentStyle.borderLeftWidth;
|
||||
} else {
|
||||
leftBorder =
|
||||
window.getComputedStyle(p, null).getPropertyValue('border-left-width');
|
||||
}
|
||||
|
||||
// `cssRules` is the W3C name, but isn't supported in IE until
|
||||
// version 9. IE<=8 has `rules`. We prefer `cssRules` as
|
||||
// it is less likely to have quirks if both are present.
|
||||
var rules = sheet.cssRules || sheet.rules;
|
||||
test.equal(leftBorder, "13px");
|
||||
|
||||
test.equal(rules[1].style.borderLeftWidth, "13px");
|
||||
div.parentNode.removeChild(div);
|
||||
});
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
@unlucky: 13px;
|
||||
|
||||
.unlucky-left-border {
|
||||
border-left-width: @unlucky;
|
||||
border-left: @unlucky solid white;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user