Added specLink method and changed href: "?" to href: window.location.search in reporter #177

Closed
wants to merge 1 commit into
from

3 participants

@wheresrhys

Fixes bug where any query strings specified by the user (Example use case: specifying a jQuery version to include using a url query string) are overwritten when clicking on links.

@wheresrhys wheresrhys Added specLink method in order to correctly generate hrefs for report…
…er's links. Fixes bug where any query strings specified by the user (Example use case: specifying a jQuery version to include using a url query string) are overwritten when clicking on these links.
fec9084
@infews

What is the use case for this? And do you have tests that demonstrate the problem?

@wheresrhys

If you go to https://github.com/wheresrhys/jQuery-flickbook/tests/testSuite.php you'll see that a get parameter is passed in to the test page in order to specify the version of jQuery to include. At present clicking on any individual test/subsuite link replaces the entire GET query string, thus leading to jQuery not being included when the page reloads.

So that was the problem I had, but in general the links break if the user, for whatever reason, accesses the test page using a query srtring in the URL.

@ragaskar

It seems OK to preserve the query params. We'll need to rewrite this for the HTML reporter and get some spec coverage around it.

@stas stas added a commit to stas/jasmine that referenced this pull request Mar 5, 2012
@stas stas Introducing `pageURI` method to handle test cases links with custom l…
…ocation.

Basically this should solve issues like #177.
Developer should be able to customize `pageURI` method for the reporter he's using.
Ex.:

```javascript
var jasmineEnv = jasmine.getEnv();
var reporter = new jasmine.TrivialReporter();
reporter.pageURI = function(path){ return window.location.pathname + path };
jasmineEnv.addReporter(reporter);
jasmineEnv.execute();
```
13cd56a
@ragaskar

Closing in favor of #197

@ragaskar ragaskar closed this May 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment