julissammateo / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

CSS File is Loaded, but Rules Don't Apply #81

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
------------------------------
--- jsTestDriver.conf: 
------------------------------
load:
  - stylesheetTest.css
  - stylesheetTest.js

------------------------------
--- styleSheetTest.css
------------------------------
body { color: red; }

------------------------------
--- styleSheetTest.js
------------------------------
JsTestDriverTest = TestCase("JsTestDriverTest");
JsTestDriverTest.prototype.setUp = function()
{
    /*:DOC += <div>Testing Text</div> */
};

The stylesheet is being loaded as a <link> element for the test just fine,
but the text is not red in Firefox 3.5, Chrome 4, and Safari 4.  It appears
as expected (red) in IE7.  This isn't just limited to color, it doesn't
apply any css rules from an external stylesheet.

Using JS Test Driver 1.0.6 Eclipse Plugin

Original issue reported on code.google.com by zachleat...@gmail.com on 17 Dec 2009 at 5:11

GoogleCodeExporter commented 8 years ago
There is a serious issue where the CSS is not yet loaded, but the test runs 
anyway.  I've written about it here:
http://www.zachleat.com/web/2010/07/29/load-css-dynamically/

But since the request is same-domain, we can just use ajax to synchronously 
load the content.  I've attached a new StylesheetLoader.js (from the 1.2.1 
branch unfortunately) that fixes the issue.  Would love to see this merged, so 
CSS rules can be applied to the tests.  I've already had great success with it 
locally.

Original comment by zachleat...@gmail.com on 31 Aug 2010 at 1:17

Attachments: