-
Notifications
You must be signed in to change notification settings - Fork 4k
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:date-picker): move class control to host #4207
Conversation
Deploy preview for ng-zorro-master ready! Built with commit a5b60ff |
cf84758
to
a95ece5
Compare
Codecov Report
@@ Coverage Diff @@
## master #4207 +/- ##
=========================================
- Coverage 92.22% 92.2% -0.02%
=========================================
Files 522 521 -1
Lines 11107 11018 -89
Branches 2018 1997 -21
=========================================
- Hits 10243 10159 -84
+ Misses 436 429 -7
- Partials 428 430 +2
Continue to review full report at Codecov.
|
/** | ||
* @license | ||
* Copyright Alibaba.com All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE | ||
*/ | ||
|
||
import { DebugElement } from '@angular/core'; | ||
import { By } from '@angular/platform-browser'; | ||
import { NzPickerComponent } from './picker.component'; | ||
|
||
export function getPickerAbstract<T = HTMLElement>(debugElement: DebugElement): T { | ||
return debugElement.query(By.css('.ant-calendar-picker')).nativeElement; | ||
} | ||
|
||
export function getPickerTrigger(debugElement: DebugElement): HTMLElement { | ||
return debugElement.query(By.directive(NzPickerComponent)).nativeElement; | ||
} | ||
|
||
export function getPickerInput(debugElement: DebugElement): HTMLInputElement { | ||
return debugElement.query(By.css('div .ant-calendar-picker-input')).nativeElement as HTMLInputElement; | ||
} | ||
|
||
export function getRangePickerLeftInput(debugElement: DebugElement): HTMLInputElement { | ||
return debugElement.queryAll(By.css('div input.ant-calendar-range-picker-input'))[0] | ||
.nativeElement as HTMLInputElement; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个文件可以放到一个 testing 目录底下
@@ -168,6 +193,8 @@ export abstract class AbstractPickerComponent implements OnInit, OnChanges, OnDe | |||
this.cdr.markForCheck(); | |||
} | |||
|
|||
updateHostClass(): void {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
空方法删掉?
[ngClass]="nzClassName" | ||
[style]="nzStyle" | ||
[ngStyle]="pickerStyle" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
者几个属性应该是在 host
上生效的,再确认一下 react 那边
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以考虑废弃掉,让用户直接使用 ngClass
和 ngStyle
或者原生属性。 不过可能会有 break change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是在 host 上生效的。
@wendzhue @hsuanxyz 要不 9.0.0 合?DOM 结构变了对用 css 的用户来说确实有 break change。 |
Close #1614
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
新增: