diff --git a/components/grid/nz-grid.spec.ts b/components/grid/nz-grid.spec.ts
index fd46c17d36d..a0ae969387b 100644
--- a/components/grid/nz-grid.spec.ts
+++ b/components/grid/nz-grid.spec.ts
@@ -16,6 +16,9 @@ import { NzColDirective } from './nz-col.directive';
import { NzGridModule } from './nz-grid.module';
import { NzRowDirective } from './nz-row.directive';
+// tslint:disable-next-line no-any
+declare const viewport: any;
+
describe('grid', () => {
describe('basic', () => {
let fixture: ComponentFixture
;
@@ -172,22 +175,32 @@ describe('grid', () => {
expect(cols.slice(0, 4).every(col => col.nativeElement.classList.contains('gutter-row'))).toBe(true);
});
- it('should responsive work', () => {
- // TODO: fake media query
+ it('should responsive work', fakeAsync(() => {
+ viewport.set(1000, 1000);
+ window.dispatchEvent(new Event('resize'));
fixture.detectChanges();
- expect(rows[1].nativeElement.style.cssText).toBe('margin-left: -4px; margin-right: -4px;');
+ tick(100);
+ fixture.detectChanges();
+
+ expect(rows[1].nativeElement.style.cssText).toBe('margin-left: -16px; margin-right: -16px;');
expect(
- cols.slice(4, 8).every(col => col.nativeElement.style.cssText === 'padding-left: 4px; padding-right: 4px;')
+ cols.slice(4, 8).every(col => col.nativeElement.style.cssText === 'padding-left: 16px; padding-right: 16px;')
).toBe(true);
expect(cols.slice(4, 8).every(col => col.nativeElement.classList.contains('gutter-row'))).toBe(true);
+
+ viewport.set(480, 480);
window.dispatchEvent(new Event('resize'));
fixture.detectChanges();
+ tick(100);
+ fixture.detectChanges();
expect(rows[1].nativeElement.style.cssText).toBe('margin-left: -4px; margin-right: -4px;');
expect(
cols.slice(4, 8).every(col => col.nativeElement.style.cssText === 'padding-left: 4px; padding-right: 4px;')
).toBe(true);
expect(cols.slice(4, 8).every(col => col.nativeElement.classList.contains('gutter-row'))).toBe(true);
- });
+
+ viewport.reset();
+ }));
});
describe('offset', () => {
diff --git a/components/grid/nz-row.directive.ts b/components/grid/nz-row.directive.ts
index 75636858870..2880da18f06 100644
--- a/components/grid/nz-row.directive.ts
+++ b/components/grid/nz-row.directive.ts
@@ -24,32 +24,12 @@ import { Platform } from '@angular/cdk/platform';
import { fromEvent, Subject } from 'rxjs';
import { auditTime, takeUntil } from 'rxjs/operators';
-import { IndexableObject, NzUpdateHostClassService } from 'ng-zorro-antd/core';
+import { responsiveMap, Breakpoint, IndexableObject, NzUpdateHostClassService } from 'ng-zorro-antd/core';
export type NzJustify = 'start' | 'end' | 'center' | 'space-around' | 'space-between';
export type NzAlign = 'top' | 'middle' | 'bottom';
export type NzType = 'flex' | null;
-export enum Breakpoint {
- 'xxl',
- 'xl',
- 'lg',
- 'md',
- 'sm',
- 'xs'
-}
-
-export type BreakpointMap = { [index in keyof typeof Breakpoint]: string };
-
-const responsiveMap: BreakpointMap = {
- xs: '(max-width: 575px)',
- sm: '(min-width: 576px)',
- md: '(min-width: 768px)',
- lg: '(min-width: 992px)',
- xl: '(min-width: 1200px)',
- xxl: '(min-width: 1600px)'
-};
-
@Directive({
selector: '[nz-row],nz-row',
exportAs: 'nzRow',
@@ -88,11 +68,11 @@ export class NzRowDirective implements OnInit, OnChanges, AfterViewInit, OnDestr
}
watchMedia(): void {
- // @ts-ignore
- Object.keys(responsiveMap).map((screen: Breakpoint) => {
- const matchBelow = this.mediaMatcher.matchMedia(responsiveMap[screen]).matches;
+ Object.keys(responsiveMap).map((screen: string) => {
+ const castBP = screen as Breakpoint;
+ const matchBelow = this.mediaMatcher.matchMedia(responsiveMap[castBP]).matches;
if (matchBelow) {
- this.breakPoint = screen;
+ this.breakPoint = castBP;
}
});
this.updateGutter();
diff --git a/components/karma.conf.js b/components/karma.conf.js
index 7abe9e875ea..e70138f4561 100644
--- a/components/karma.conf.js
+++ b/components/karma.conf.js
@@ -4,14 +4,15 @@
module.exports = function(config) {
config.set({
basePath: '',
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
+ frameworks: ['jasmine', '@angular-devkit/build-angular', 'viewport'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-spec-reporter'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
- require('@angular-devkit/build-angular/plugins/karma')
+ require('@angular-devkit/build-angular/plugins/karma'),
+ require('karma-viewport')
],
client: {
clearContext: true // leave Jasmine Spec Runner output visible in browser
diff --git a/components/ng-zorro-antd.module.ts b/components/ng-zorro-antd.module.ts
index f5ffc7d29bb..6304d925c33 100644
--- a/components/ng-zorro-antd.module.ts
+++ b/components/ng-zorro-antd.module.ts
@@ -18,6 +18,7 @@ import { NzCollapseModule } from 'ng-zorro-antd/collapse';
import { NzCommentModule } from 'ng-zorro-antd/comment';
import { NzNoAnimationModule, NzWaveModule } from 'ng-zorro-antd/core';
import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
+import { NzDescriptionsModule } from 'ng-zorro-antd/descriptions';
import { NzDividerModule } from 'ng-zorro-antd/divider';
import { NzDrawerModule } from 'ng-zorro-antd/drawer';
import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
@@ -78,6 +79,7 @@ export * from 'ng-zorro-antd/collapse';
export * from 'ng-zorro-antd/comment';
export * from 'ng-zorro-antd/core';
export * from 'ng-zorro-antd/date-picker';
+export * from 'ng-zorro-antd/descriptions';
export * from 'ng-zorro-antd/divider';
export * from 'ng-zorro-antd/drawer';
export * from 'ng-zorro-antd/drawer';
@@ -185,7 +187,8 @@ export * from './version';
NzNoAnimationModule,
NzSkeletonModule,
NzStatisticModule,
- NzEmptyModule
+ NzEmptyModule,
+ NzDescriptionsModule
]
})
export class NgZorroAntdModule {
diff --git a/package.json b/package.json
index 755c8cde3dd..8c8bcc6c00b 100644
--- a/package.json
+++ b/package.json
@@ -60,8 +60,8 @@
"@angular/http": "~7.2.0",
"@angular/language-service": "~7.2.0",
"@angular/platform-browser": "~7.2.0",
- "@angular/platform-server": "^7.2.14",
"@angular/platform-browser-dynamic": "~7.2.0",
+ "@angular/platform-server": "^7.2.14",
"@angular/pwa": "^0.12.2",
"@angular/router": "~7.2.0",
"@angular/service-worker": "~7.2.0",
@@ -88,6 +88,7 @@
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-spec-reporter": "0.0.32",
+ "karma-viewport": "^1.0.4",
"less": "^3.9.0",
"less-plugin-clean-css": "^1.5.1",
"lint-staged": "^8.1.5",
diff --git a/scripts/prerender/static.paths.ts b/scripts/prerender/static.paths.ts
index 939de5cfb02..1abf82c30a2 100644
--- a/scripts/prerender/static.paths.ts
+++ b/scripts/prerender/static.paths.ts
@@ -34,6 +34,8 @@ export const ROUTES = [
'/components/comment/zh',
'/components/date-picker/en',
'/components/date-picker/zh',
+ '/components/descriptions/en',
+ '/components/descriptions/zh',
'/components/divider/en',
'/components/divider/zh',
'/components/drawer/en',