Giter VIP home page Giter VIP logo

Comments (3)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024
Hi, 

I tried it a bit further: I took the Runnerquirks.html page from 
JsTestDriver.jar 
and added my special bootstrap into the head section there. This worked well so 
far. 
I further added some HTML into the body of the Runnerquirks.html file, however 
this 
is not working (it seems that the body content is reset by the framework). 

I then wrote a setUp() method in my test case where I defined the innerHTML of 
the 
body manually like this:  

TestSample.setUp = function(sTestName) {    
  document.body.innerHTML = "<div id=\"uiArea\"></div>";

  document.attachEvent("load", function() {
    var oButton = new Button("b1", {Text:"Hello"});  // "Button" is a custom widget
    setRoot("uiArea", oButton);              // "setRoot" is a function 
                                                     // from my bootstrap which is 
                                                     // setting the widget into the  
                                                     // div
  });           
};

My test function is able to access the "uiArea" div element, but not the "b1" 
Button 
widget as it is just created when the document has been loaded!

Questions: 
* Are there other ways how to define a HTML document as part of the text 
fixture? 
  Proposal: It should be possible to define an arbitrary HTML document containing 
the unit tests, get it loaded by the framework, and inject the framework JS 
files 
into the document. 
* How can widgets be tested which are rendered on the onLoad event of the 
document? 
The JSTD seems to run the unit tests already before this event is occuring. 

Best regards,
 Timo

Original comment by [email protected] on 2 Oct 2009 at 12:08

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024
Hi Timo,

We do not have a setUp/tearDown on the suite level.

For your other questions:
to define HTML you can use our special syntactic sugar see:
http://code.google.com/p/js-test-driver/wiki/HtmlDoc

Testing on the onload can be an issue as we are always keeping the browser hot 
and
not refreshing/reloading the page every time we run the tests. Maybe you could 
try to
run your tests in a different way?

Original comment by [email protected] on 2 Nov 2009 at 7:09

from js-test-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024
Dropping this, as there hasn't been a response in 3 years.

Original comment by [email protected] on 6 Jun 2012 at 11:22

  • Changed state: Invalid

from js-test-driver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.