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

Move url space regexp tests to iron-location #95

Merged
merged 1 commit into from
May 7, 2016
Merged
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
50 changes: 0 additions & 50 deletions test/carbon-location.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@
Polymer.Base.fire('location-changed', {}, { node: window });
}

// iron-location listens for the click, if it matches the url space
// configuration, then it prevents default.
function setLocationClick(url) {
var clickableLink = fixture('ClickableLink');
clickableLink.setAttribute('href', url);
MockInteractions.tap(clickableLink);
}

function assign(a, b) {
if (Object.assign) {
return Object.assign.apply(Object, arguments);
Expand Down Expand Up @@ -141,48 +133,6 @@
});
});
});

suite('manipulating the urlSpace', function() {
var pageUrl;
var originalLocation;

setup(function() {
pageUrl = carbonLocation.$$('iron-location');
originalLocation = window.location.toString();
});

teardown(function() {
setLocation(originalLocation);
});

test('changing the urlSpace pattern and testing paths', function() {
setLocationClick('/test');

carbonLocation.urlSpaceRegex = '/foo';

expect(carbonLocation.route.path).to.be.equal('/test');

setLocationClick('/foo');
expect(carbonLocation.route.path).to.be.equal('/foo');

setLocationClick('/foo/bar');
expect(carbonLocation.route.path).to.be.equal('/foo/bar');

setLocationClick('/bar');
expect(carbonLocation.route.path).to.be.equal('/foo/bar');

carbonLocation.urlSpaceRegex = '/foo/[0-9]+';

setLocationClick('/foo/123');
expect(carbonLocation.route.path).to.be.equal('/foo/123');

setLocationClick('/foo/');
expect(carbonLocation.route.path).to.be.equal('/foo/123');

setLocationClick('/foo/456');
expect(carbonLocation.route.path).to.be.equal('/foo/456');
});
});
});

suite('using the hash as the route path', function() {
Expand Down