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

refactor(module:affix): migrate demo to standalone mode #8727

Merged
merged 1 commit into from
Sep 4, 2024
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
13 changes: 6 additions & 7 deletions components/affix/affix.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BidiModule, Dir, Directionality } from '@angular/cdk/bidi';
import { BidiModule, Dir, Direction, Directionality } from '@angular/cdk/bidi';
import { Platform } from '@angular/cdk/platform';
import { DOCUMENT } from '@angular/common';
import { Component, DebugElement, ElementRef, Renderer2, ViewChild } from '@angular/core';
Expand Down Expand Up @@ -358,7 +358,7 @@ describe('affix', () => {
discardPeriodicTasks();
}));

it(`emit false when is unaffixed`, fakeAsync(() => {
it(`emit false when isn't affixed`, fakeAsync(() => {
setupInitialState();
emitScroll(window, defaultOffsetTop + startOffset + 1);
emitScroll(window, defaultOffsetTop + startOffset - 1);
Expand Down Expand Up @@ -524,8 +524,7 @@ describe('affix RTL', () => {
dl = fixture.debugElement;
}));
it('should className correct on dir change', fakeAsync(() => {
const value = 10;
context.newOffsetBottom = value;
context.newOffsetBottom = 10;
context.fakeTarget = window;
fixture.detectChanges();
const el = dl.query(By.css('nz-affix')).nativeElement as HTMLElement;
Expand Down Expand Up @@ -555,7 +554,7 @@ describe('affix RTL', () => {
})
class TestAffixComponent {
@ViewChild(NzAffixComponent, { static: true }) nzAffixComponent!: NzAffixComponent;
fakeTarget: string | Element | Window | null = null;
fakeTarget?: string | Element | Window;
newOffset!: number;
newOffsetBottom!: number;
}
Expand All @@ -572,10 +571,10 @@ class TestAffixComponent {
})
export class TestAffixRtlComponent {
@ViewChild(Dir) dir!: Dir;
direction = 'rtl';
direction: Direction = 'rtl';

@ViewChild(NzAffixComponent, { static: true }) nzAffixComponent!: NzAffixComponent;
fakeTarget: string | Element | Window | null = null;
fakeTarget?: string | Element | Window;
newOffset!: number;
newOffsetBottom!: number;
}
Expand Down
5 changes: 5 additions & 0 deletions components/affix/demo/basic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { Component } from '@angular/core';

import { NzAffixModule } from 'ng-zorro-antd/affix';
import { NzButtonModule } from 'ng-zorro-antd/button';

@Component({
standalone: true,
selector: 'nz-demo-affix-basic',
imports: [NzAffixModule, NzButtonModule],
template: `
<nz-affix [nzOffsetTop]="offsetTop">
<button nz-button nzType="primary" (click)="setOffsetTop()">
Expand Down
5 changes: 0 additions & 5 deletions components/affix/demo/module

This file was deleted.

5 changes: 5 additions & 0 deletions components/affix/demo/on-change.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { Component } from '@angular/core';

import { NzAffixModule } from 'ng-zorro-antd/affix';
import { NzButtonModule } from 'ng-zorro-antd/button';

@Component({
standalone: true,
selector: 'nz-demo-affix-on-change',
imports: [NzAffixModule, NzButtonModule],
template: `
<nz-affix [nzOffsetTop]="120" (nzChange)="onChange($event)">
<button nz-button>
Expand Down
5 changes: 5 additions & 0 deletions components/affix/demo/target.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { Component } from '@angular/core';

import { NzAffixModule } from 'ng-zorro-antd/affix';
import { NzButtonModule } from 'ng-zorro-antd/button';

@Component({
standalone: true,
selector: 'nz-demo-affix-target',
imports: [NzAffixModule, NzButtonModule],
template: `
<div class="scrollable-container" #target>
<div class="background">
Expand Down