Skip to content

Commit

Permalink
chore(lint): lint ulrRouterSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Mar 16, 2017
1 parent 5a526ce commit de5c5d0
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions test/urlRouterSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { StateRegistry } from "../src/state/stateRegistry";
import { noop } from "../src/common/common";
import { UrlRule, MatchResult } from "../src/url/interface";

declare var jasmine;
var _anything = jasmine.anything();
declare let jasmine;
let _anything = jasmine.anything();

describe("UrlRouter", function () {
var router: UIRouter;
var urlRouter: UrlRouter,
let router: UIRouter;
let urlRouter: UrlRouter,
urlService: UrlService,
urlMatcherFactory: UrlMatcherFactory,
stateService: StateService,
Expand Down Expand Up @@ -62,8 +62,8 @@ describe("UrlRouter", function () {
});

it('`rule` should return a deregistration function', function() {
var count = 0;
var rule: UrlRule = {
let count = 0;
let rule: UrlRule = {
match: () => count++,
handler: match => match,
matchPriority: () => 0,
Expand All @@ -85,8 +85,8 @@ describe("UrlRouter", function () {
});

it('`removeRule` should remove a previously registered rule', function() {
var count = 0;
var rule: UrlRule = {
let count = 0;
let rule: UrlRule = {
match: () => count++,
handler: match => match,
matchPriority: () => 0,
Expand Down Expand Up @@ -161,7 +161,7 @@ describe("UrlRouter", function () {
describe("URL generation", function() {
it("should return null when UrlMatcher rejects parameters", function () {
urlMatcherFactory.type("custom", <any> { is: val => val === 1138 });
var urlmatcher = matcher("/foo/{param:custom}");
let urlmatcher = matcher("/foo/{param:custom}");

expect(urlRouter.href(urlmatcher, { param: 1138 })).toBe('#/foo/1138');
expect(urlRouter.href(urlmatcher, { param: 5 })).toBeNull();
Expand All @@ -174,12 +174,12 @@ describe("UrlRouter", function () {

describe('Url Rule priority', () => {

var matchlog: string[];
let matchlog: string[];
beforeEach(() => matchlog = []);
const log = (id) => () => (matchlog.push(id), null);

it("should prioritize a path with a static string over a param 1", () => {
var spy = spyOn(stateService, "transitionTo");
let spy = spyOn(stateService, "transitionTo");
let A = stateRegistry.register({ name: 'A', url: '/:pA' });
let B = stateRegistry.register({ name: 'B', url: '/BBB' });

Expand All @@ -191,7 +191,7 @@ describe("UrlRouter", function () {
});

it("should prioritize a path with a static string over a param 2", () => {
var spy = spyOn(stateService, "transitionTo");
let spy = spyOn(stateService, "transitionTo");
stateRegistry.register({ name: 'foo', url: '/foo' });
let A = stateRegistry.register({ name: 'foo.A', url: '/:pA' });
let B = stateRegistry.register({ name: 'B', url: '/foo/BBB' });
Expand Down Expand Up @@ -269,7 +269,7 @@ describe("UrlRouter", function () {

urlService.url("/foo/123/456?query=blah");
expect(matchlog).toEqual([1, 2]);
})
});
});
});

Expand All @@ -284,7 +284,7 @@ describe("UrlRouter", function () {
it("should return the best match for a URL 1", () => {
let match: MatchResult = urlRouter.match({ path: '/BBB' });
expect(match.rule.type).toBe("STATE");
expect(match.rule['state']).toBe(B)
expect(match.rule['state']).toBe(B);
});

it("should return the best match for a URL 2", () => {
Expand Down Expand Up @@ -312,7 +312,7 @@ describe("UrlRouter", function () {
};

registry.register({ name: 'lazy.**', url: '/lazy', lazyLoad: lazyLoad });
registry.register({ name: 'param', url: '/:param', });
registry.register({ name: 'param', url: '/:param' });

router.transitionService.onSuccess({}, trans => {
expect(trans.$to()).toBe(loadedState);
Expand All @@ -322,22 +322,22 @@ describe("UrlRouter", function () {
});

router.urlService.url('/lazy');
})
})
});
});
});

describe('UrlRouter.deferIntercept', () => {
var $ur, $url;
let $ur, $url;
beforeEach(function() {
var router = new UIRouter();
let router = new UIRouter();
router.urlRouter.deferIntercept();
router.plugin(TestingPlugin);
$ur = router.urlRouter;
$url = router.urlService;
});

it("should allow location changes to be deferred", function () {
var log = [];
let log = [];

$ur.rule($ur.urlRuleFactory.create(/.*/, () => log.push($url.path())));

Expand Down

0 comments on commit de5c5d0

Please sign in to comment.