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

Corrected pushstate tests and update can.test.route #1098

Merged
merged 4 commits into from
Jul 8, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions route/pushstate/pushstate_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,12 @@ steal('can/route/pushstate', "can/test", function () {
can.$("#qunit-test-area")[0].appendChild(iframe);
});


test("root can include the domain", function () {
// Allows bindings.pushstate.root to handle the full domain instead of just the pathname
stop();
makeTestingIframe(function(info, done){
info.route.bindings.pushstate.root = "/";
info.route.bindings.pushstate.root = can.test.path("route/pushstate/testing.html", true).replace("route/pushstate/testing.html", "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't can.test.path("route/pushstate/testing.html", true).replace("route/pushstate/testing.html", ""); the same as can.test.path("")?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think steal adds a .js to ""

Sent from my iPhone

On Jun 19, 2014, at 4:01 PM, David Luecke notifications@github.com wrote:

In route/pushstate/pushstate_test.js:

            stop();
            makeTestingIframe(function(info, done){
  •               info.route.bindings.pushstate.root = "/";
    
  •               info.route.bindings.pushstate.root = can.test.path("route/pushstate/testing.html", true).replace("route/pushstate/testing.html", "");
    
    Isn't can.test.path("route/pushstate/testing.html", true).replace("route/pushstate/testing.html", ""); the same as can.test.path("")?


Reply to this email directly or view it on GitHub.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even to something ending with /?

info.route(":module/:plugin/:page\\.html");
info.route.ready();

Expand All @@ -645,7 +647,7 @@ steal('can/route/pushstate', "can/test", function () {
test("URL's don't greedily match", function () {
stop();
makeTestingIframe(function(info, done){
info.route.bindings.pushstate.root = "/";
info.route.bindings.pushstate.root = can.test.path("route/pushstate/testing.html", true).replace("route/pushstate/testing.html", "");
info.route(":module\\.html");
info.route.ready();

Expand All @@ -657,7 +659,7 @@ steal('can/route/pushstate', "can/test", function () {
}, 100);
});
});

}

test("routed links must descend from pushstate root (#652)", 1, function () {
Expand Down
11 changes: 9 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@ steal('can/util', function() {
}
return path;
},
path: function (path) {
path: function (path, absolute) {
//absolute prevents require.toURL from returning a relative path
if (typeof steal !== 'undefined') {
return ""+steal.idToUri(steal.id("can/"+path).toString()) ;
}

if (window.require && require.toUrl && !viewCheck.test(path)) {
if (!absolute && window.require && require.toUrl && !viewCheck.test(path)) {
return require.toUrl(path);
}

var pathIndex = window.location.href.indexOf('/test/')
if(pathIndex){
return window.location.href.substring(0, pathIndex + 1) + path;
}

return path;
}
}
Expand Down