refactor(all): strict boolean conditions

This commit is contained in:
Manu Mtz.-Almeida
2018-08-31 18:59:09 +02:00
parent f383ebdf13
commit ba2230510e
96 changed files with 990 additions and 962 deletions

View File

@ -108,22 +108,22 @@ export class Button {
}
}
onFocus() {
private onFocus() {
this.ionFocus.emit();
}
onKeyUp() {
private onKeyUp() {
this.keyFocus = true;
}
onBlur() {
private onBlur() {
this.keyFocus = false;
this.ionBlur.emit();
}
onClick(ev: Event) {
private onClick(ev: Event) {
if (this.type === 'button') {
openURL(this.win, this.href, ev, this.routerDirection);
return openURL(this.win, this.href, ev, this.routerDirection);
} else if (hasShadowDom(this.el)) {
// this button wants to specifically submit a form
@ -142,6 +142,7 @@ export class Button {
fakeButton.remove();
}
}
return Promise.resolve(false);
}
hostData() {
@ -163,7 +164,7 @@ export class Button {
protected render() {
const TagType = this.href ? 'a' : 'button';
const TagType = this.href === undefined ? 'button' : 'a';
const attrs = (TagType === 'button')
? { type: this.type }
: { href: this.href };
@ -194,7 +195,7 @@ export class Button {
* e.g. alert-button, action-sheet-button
*/
function getButtonClassMap(buttonType: string | undefined, mode: Mode): CssClassMap {
if (!buttonType) {
if (buttonType === undefined) {
return {};
}
return {
@ -208,7 +209,7 @@ function getButtonClassMap(buttonType: string | undefined, mode: Mode): CssClass
* e.g. block, full, round, large
*/
function getButtonTypeClassMap(buttonType: string, type: string | undefined, mode: Mode): CssClassMap {
if (!type) {
if (type === undefined) {
return {};
}
type = type.toLocaleLowerCase();
@ -221,7 +222,7 @@ function getButtonTypeClassMap(buttonType: string, type: string | undefined, mod
function getColorClassMap(buttonType: string, color: string | undefined, fill: string | undefined, mode: Mode): CssClassMap {
let className = buttonType;
if (fill) {
if (fill !== undefined) {
className += `-${fill.toLowerCase()}`;
}
@ -229,7 +230,7 @@ function getColorClassMap(buttonType: string, color: string | undefined, fill: s
[className]: true,
[`${className}-${mode}`]: true,
};
if (color) {
if (color !== undefined) {
map[`ion-color-${color}`] = true;
}
return map;