-
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
feat(module:all): simplify boolean attributes usage #459
Conversation
buttonDebugElement.nativeElement.click(); | ||
expect(testComponent.isLoading).toBe(true); | ||
setTimeout(_ => { |
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.
This is failing randomly in my local machine, fixed now. (Likely it wasn't working at all in sync function)
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.
tick
is fine
@@ -40,7 +40,12 @@ export class NzButtonComponent implements AfterContentInit { | |||
|
|||
@Input() | |||
set nzGhost(value: boolean) { | |||
this._ghost = value; | |||
const ghost = value as boolean | '' |
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.
This way it will not change the property type, user still get boolean
value when access via API. (getter & setter must have same type)
@Input() nzMode = 'year'; | ||
@Input() nzFullScreen = true; | ||
@Input() nzShowHeader = true; | ||
@Input() nzDisabledDate: Function; | ||
|
||
@Input() | ||
get nzValue(): Date { |
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.
@Input()
should always on setter rather than getter, same below.
} | ||
|
||
@Input() | ||
@HostBinding('class.ant-card-no-hovering') |
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.
Theoretically @HostBinding()
should on getter, but TypeScript requires all decorators on same part.
@@ -67,15 +68,24 @@ import { NzDropDownComponent } from './nz-dropdown.component'; | |||
}) | |||
|
|||
export class NzDropDownButtonComponent extends NzDropDownComponent implements OnInit, OnDestroy, AfterViewInit { | |||
@Input() nzDisable = false; |
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.
Here is a breaking bug fix, using nzDisable
instead of nzDisabled
is just a typo, but should be mentioned in change log.
should it be merged now or later? |
Later, still working on it... 😃 |
} | ||
|
||
@ViewChild('ref') | ||
_ref; | ||
|
||
@HostBinding('class.ant-spin-nested-loading') | ||
private get isNested() { |
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.
@HostBinding()
cannot use private
since it's accessed by external class.
Ready for review, likely it would require local checkout. Coverage decrease is caused by extra getter/setter (which are functions and counted), could be ignored. |
get subItemSelected(): boolean { | ||
return !!this.nzMenuComponent.menuItems.find(e => e.selected && e.nzSubMenuComponent === this); |
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.
It was accessing internal field originally, added type info for menuItems
to allow type checking.
this.isLoadingOne = false; | ||
}, 5000); | ||
}; | ||
loadTwo = (value) => { |
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.
will cause error when click Click me!
button
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.
will check it.
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.
Thx, it's just by mistake.
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: closes #458, closes #648.
(There will be a different PR for #460)
What is the new behavior?
Does this PR introduce a breaking change?
Other information