-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
In order to use the same HTML in a testcase with several css files that are checked out of our source code repository I'd like to be able to put the following in a testcase:
<script>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var css = getParameterByName('css');
if (css) {
document.write('<link rel="stylesheet" href="+' css '+">')
}
</script>and then in the regression runner, (using the array props feature in #64):
function cssSpecificTestsForUrl(cssfiles, url){
return cssfiles.map(function(css){
return url +'?css='+ css;
});
}
var cssfiles = ['/path/to/file1.css','/path/to/file2.css','/path/to/file3.css'/*...file20*/];
var testcaseurl = 'testcase123.html';
csscritic.add({ url: cssSpecificTestsForUrl(cssfiles, testcaseurl)
, width: 100
, height: 100
})In order for this to work the sandboxing of iframes would need to have 'allow-scripts' added. However, the rasterization appears to be done before the scripts are run so something would need to be done to delay rasterization until the page is fully rendered. (I can work on this but I think I'll need some pointers as to where to look.)
niedzielski
Metadata
Metadata
Assignees
Labels
No labels