Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for single page web-apps #7

Open
rprieto opened this issue May 29, 2012 · 0 comments
Open

Support for single page web-apps #7

rprieto opened this issue May 29, 2012 · 0 comments

Comments

@rprieto
Copy link

rprieto commented May 29, 2012

I started using Dominator to test a single-page webapp (actually a PhoneGap app).
My setup looks like:

 dominator.load({ src: 'http://localhost:4567'   ...    });

Now each test can start navigating, which is just clicking and rendering views within the one page.

Currently it seems that the open function really expects physical pages. Is would be great if we could also pass it an absolute URL, so that each test can simply reset the entire app and start fresh. My current workaround is:

var HOME = 'http://localhost:4567';

dominator.extend('home', function(callback) {
    this.window.location.href = HOME;
    this.expect(1);
    var intervalId = setInterval(function() {
        if (this.window && this.window.location.href.indexOf(HOME) >= 0) {
            QUnit.ok(true, HOME + ' loaded');
            clearTimeout(intervalId);
            callback();
        }
    }, 100);
});

So each test can do:

[TEST 1]    dominator.home().click('foo') ...
[TEST 2]    dominator.home().click('bar') ...

// home() doesn't take any argument for simplicity reasons.
// Ideally it would just reset to whatever URL the iframe was created with.

Is there an easier way I'm missing, or does that functionality make sense?

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant