Skip to content

Commit

Permalink
feat(router): make true default for viewport scope
Browse files Browse the repository at this point in the history
  • Loading branch information
jwx committed Aug 16, 2019
1 parent 9e844a8 commit 4298d78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/__tests__/router/router.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ describe('Router', function () {

const { lifecycle, host, router, tearDown } = await setup();

await $goto('foo@left+bar@right+baz@foo+qux@bar', router, lifecycle);
// await $goto('foo@left+bar@right+baz@foo+qux@bar', router, lifecycle);
await $goto('foo@left/baz@foo+bar@right/qux@bar', router, lifecycle);
assert.includes(host.textContent, 'Viewport: foo', `host.textContent`);
assert.includes(host.textContent, 'Viewport: bar', `host.textContent`);
assert.includes(host.textContent, 'Viewport: baz', `host.textContent`);
Expand Down
6 changes: 3 additions & 3 deletions packages/router/src/resources/viewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export class ViewportCustomElement {
public static readonly inject: readonly Key[] = [IRouter, INode, IRenderingEngine];

@bindable public name: string;
@bindable public scope: boolean;
@bindable public usedBy: string;
@bindable public default: string;
@bindable public noScope: boolean;
@bindable public noLink: boolean;
@bindable public noHistory: boolean;
@bindable public stateful: boolean;
Expand All @@ -48,9 +48,9 @@ export class ViewportCustomElement {

constructor(router: IRouter, element: Element, renderingEngine: IRenderingEngine) {
this.name = 'default';
this.scope = null;
this.usedBy = null;
this.default = null;
this.noScope = null;
this.noLink = null;
this.noHistory = null;
this.stateful = null;
Expand Down Expand Up @@ -105,7 +105,7 @@ export class ViewportCustomElement {
}

public connect(): void {
const options: IViewportOptions = { scope: this.element.hasAttribute('scope') };
const options: IViewportOptions = { scope: !this.element.hasAttribute('no-scope') };
if (this.usedBy && this.usedBy.length) {
options.usedBy = this.usedBy;
}
Expand Down

0 comments on commit 4298d78

Please sign in to comment.