wwag110465 / js-test-driver

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

Request: Serve that actually serves (ie. load non-JS files) #324

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. You add a "serve:" file in jsTestDriver.conf
2. You try to access the file
3. It's not there
4. You write convoluted code to get it there

While "serve" is great for exposing files, exposing files is half (or less) of 
the battle.  What I (and others I'm sure) could really use is a way of staying 
"stick this CSS/HTML on to the page while I'm running my test".  Currently as I 
understand it:

load:
- file1.js
- file2.js

essentially results in the following being appended to the page during the test 
run:
<script src="file1.js"/>
<script src="file2.js"/>

What would be awesome is if one could do:

load:
- file1.js
- file3.htm # this is just "<h1>Hello World</h1>"
- file4.css
- file2.js

and get the following result in their test run:
<script src="file1.js"/>
<h1>Hello World</h1>
<link src="file4.css"/>
<script src="file2.js"/>

Or, failing that, have the HTML simply appended to document.body.  This feature 
would be REALLY handy when dealing with templates that are stored in HTML files 
(and would make adding CSS to tests easier too).

Original issue reported on code.google.com by machineg...@gmail.com on 4 Jan 2012 at 7:41

GoogleCodeExporter commented 8 years ago
edit: staying=>saying

Original comment by machineg...@gmail.com on 4 Jan 2012 at 7:42

GoogleCodeExporter commented 8 years ago
JsTD is designed for unittests, and following the best practices, doesn't much 
offer support for globally scoped data. This includes HTML, as I'm sure you've 
noticed, the body is cleared after each test. CSS is one of the few exceptions 
(only because the support is fairly nascent, and I haven't precisely determined 
the art of cross browser css enabling and disabling.)

For html please see: http://code.google.com/p/js-test-driver/wiki/HtmlDoc

So, roughly translated, I don't see the need for feature as you describe it 
here. Not that the pain isn't relevant: There have been requests for loading 
html held in external files 
(http://code.google.com/p/js-test-driver/issues/detail?id=61) but I have yet to 
see a clean way to ensure that a given html fragment is associated with a 
TestCase, as part of the config. (I regret to note, it isn't a top priority at 
the moment.)

This doesn't prevent you from implementing it as a plugin (though, the 
configuration  parsing is a little rough to change in head. I'm working on it.) 
But it is a non-trivial exercise.

I'm marking this as a duplicate, because the pain would be alleviated by an 
implementation for 61. Just not precisely as described here.

Original comment by corbinrs...@gmail.com on 4 Jan 2012 at 7:59