Skip to content

Commit 3fbb5c3

Browse files
committed
Test fixes
1 parent 1879ef3 commit 3fbb5c3

File tree

11 files changed

+26
-38
lines changed

11 files changed

+26
-38
lines changed

@types/router/state/state-object.d.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/** @typedef {import('./interface.ts').StateDeclaration} StateDeclaration */
21
/**
32
* Internal representation of a ng-router state.
43
*
@@ -8,9 +7,9 @@
87
*
98
* This class prototypally inherits from the corresponding [[StateDeclaration]].
109
* Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].
11-
* @implements {StateDeclaration}
10+
* @implements {ng.StateDeclaration}
1211
*/
13-
export class StateObject implements StateDeclaration {
12+
export class StateObject implements ng.StateDeclaration {
1413
/**
1514
* @param {import('./interface.ts').StateDeclaration} config
1615
*/
@@ -79,5 +78,4 @@ export namespace StateObject {
7978
/** Predicate which returns true if the object is an internal [[StateObject]] object */
8079
function isState(obj: any): boolean;
8180
}
82-
export type StateDeclaration = import("./interface.ts").StateDeclaration;
8381
import { Glob } from "../glob/glob.js";

@types/router/state/state-queue-manager.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export class StateQueueManager {
2727
flush(): Record<string, StateObject>;
2828
/**
2929
*
30-
* @param {StateObject} state
30+
* @param {ng.StateDeclaration} state
3131
* @returns {() => void} a function that deregisters the rule
3232
*/
33-
attachRoute(state: StateObject): () => void;
33+
attachRoute(state: ng.StateDeclaration): () => void;
3434
}
3535
import { StateObject } from "./state-object.js";

@types/router/url/url-service.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ export class UrlService {
55
static $inject: string[];
66
/**
77
* @param {ng.LocationProvider} $locationProvider
8-
* @param {import("../../router/state/state-service.js").StateProvider} stateService
8+
* @param {import("../../router/state/state-service.js").StateProvider} stateProvider
99
* @param {import("../router.js").RouterProvider} globals
1010
* @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
1111
*/
1212
constructor(
1313
$locationProvider: ng.LocationProvider,
14-
stateService: import("../../router/state/state-service.js").StateProvider,
14+
stateProvider: import("../../router/state/state-service.js").StateProvider,
1515
globals: import("../router.js").RouterProvider,
1616
urlConfigProvider: import("../../router/url/url-config.js").UrlConfigProvider,
1717
);
@@ -20,8 +20,8 @@ export class UrlService {
2020
/** @private */
2121
private _locationProvider;
2222
stateService: import("../../router/state/state-service.js").StateProvider;
23-
/** Provides services related to the URL */
24-
urlRuleFactory: UrlRuleFactory;
23+
/** @type {UrlRuleFactory} Provides services related to the URL */
24+
_urlRuleFactory: UrlRuleFactory;
2525
/**
2626
* The nested [[UrlRules]] API for managing URL rules and rewrites
2727
* @type {UrlRules}

@types/shared/utils.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,12 +531,12 @@ export function encodeUriQuery(
531531
*
532532
* @template T
533533
* @param {T} src
534-
* @param {T extends any[] ? T : undefined} [dst]
534+
* @param {T extends any[] ? T : Record<string, unknown>} [dst]
535535
* @returns {T}
536536
*/
537537
export function shallowCopy<T>(
538538
src: T,
539-
dst?: T extends any[] ? T : undefined,
539+
dst?: T extends any[] ? T : Record<string, unknown>,
540540
): T;
541541
/**
542542
* Throw error if the argument is false

src/core/parse/parse.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,8 @@ describe("parser", () => {
14131413
});
14141414

14151415
it("should mark an empty expressions as literal", () => {
1416+
debugger;
1417+
$parse("");
14161418
expect($parse("").literal).toBe(true);
14171419
expect($parse(" ").literal).toBe(true);
14181420
});

src/core/parse/parser/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ function isLiteral(ast) {
6969
return false;
7070
}
7171
} else {
72-
return false;
72+
return true;
7373
}
7474
}

src/router/scroll/view-scroll.spec.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ describe("ngView", () => {
2828
await wait(100);
2929
expect(elem.scrollIntoView).toHaveBeenCalled();
3030
});
31-
32-
it("should return the promise from the timeout", async () => {
33-
dealoc(document.getElementById("app"));
34-
const promise = $viewScroll(elem);
35-
36-
await wait(10);
37-
expect(elem.scrollIntoView).toHaveBeenCalled();
38-
expect(promise).toBeDefined();
39-
});
4031
});
4132

4233
describe("useAnchorScroll", () => {

src/router/state/state-object.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { propEq } from "../../shared/hof.js";
33
import { Glob } from "../glob/glob.js";
44
import { hasOwn, isFunction, isObject } from "../../shared/utils.js";
55

6-
/** @typedef {import('./interface.ts').StateDeclaration} StateDeclaration */
7-
86
/**
97
* Internal representation of a ng-router state.
108
*
@@ -14,7 +12,7 @@ import { hasOwn, isFunction, isObject } from "../../shared/utils.js";
1412
*
1513
* This class prototypally inherits from the corresponding [[StateDeclaration]].
1614
* Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].
17-
* @implements {StateDeclaration}
15+
* @implements {ng.StateDeclaration}
1816
*/
1917
export class StateObject {
2018
name = undefined;

src/router/state/state-queue-manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class StateQueueManager {
109109

110110
/**
111111
*
112-
* @param {StateObject} state
112+
* @param {ng.StateDeclaration} state
113113
* @returns {() => void} a function that deregisters the rule
114114
*/
115115
attachRoute(state) {

src/router/url/url-service.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ export class UrlService {
3333

3434
/**
3535
* @param {ng.LocationProvider} $locationProvider
36-
* @param {import("../../router/state/state-service.js").StateProvider} stateService
36+
* @param {import("../../router/state/state-service.js").StateProvider} stateProvider
3737
* @param {import("../router.js").RouterProvider} globals
3838
* @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
3939
*/
40-
constructor($locationProvider, stateService, globals, urlConfigProvider) {
40+
constructor($locationProvider, stateProvider, globals, urlConfigProvider) {
4141
/** @private */
4242
this._locationProvider = $locationProvider;
43-
this.stateService = stateService;
43+
this.stateService = stateProvider;
4444

45-
/** Provides services related to the URL */
46-
this.urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
45+
/** @type {UrlRuleFactory} Provides services related to the URL */
46+
this._urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
4747

4848
/**
4949
* The nested [[UrlRules]] API for managing URL rules and rewrites
5050
* @type {UrlRules}
5151
*/
52-
this.rules = new UrlRules(this.urlRuleFactory);
52+
this.rules = new UrlRules(this._urlRuleFactory);
5353
/**
5454
* The nested [[UrlConfig]] API to configure the URL and retrieve URL information
5555
* @type {import("./url-config.js").UrlConfigProvider}

0 commit comments

Comments
 (0)