Skip to content

Commit

Permalink
fix(all): lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Sep 24, 2018
1 parent b2b5d93 commit f8eafa7
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 49 deletions.
12 changes: 6 additions & 6 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ export namespace Components {
/**
* The text to display when there's no date selected yet. Using lowercase to match the input attribute
*/
'placeholder'?: string;
'placeholder'?: string | null;
/**
* the value of the datetime.
*/
Expand Down Expand Up @@ -1365,7 +1365,7 @@ export namespace Components {
/**
* The text to display when there's no date selected yet. Using lowercase to match the input attribute
*/
'placeholder'?: string;
'placeholder'?: string | null;
/**
* the value of the datetime.
*/
Expand Down Expand Up @@ -4023,11 +4023,11 @@ export namespace Components {
/**
* The text to display when the select is empty.
*/
'placeholder'?: string;
'placeholder'?: string | null;
/**
* The text to display instead of the selected option's value.
*/
'selectedText'?: string;
'selectedText'?: string | null;
/**
* the value of the select.
*/
Expand Down Expand Up @@ -4089,11 +4089,11 @@ export namespace Components {
/**
* The text to display when the select is empty.
*/
'placeholder'?: string;
'placeholder'?: string | null;
/**
* The text to display instead of the selected option's value.
*/
'selectedText'?: string;
'selectedText'?: string | null;
/**
* the value of the select.
*/
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/action-sheet/action-sheet-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export interface ActionSheetButton {
role?: 'cancel' | 'destructive' | 'selected' | string;
icon?: string;
cssClass?: string | string[];
handler?: () => boolean | void;
handler?: () => boolean | void | Promise<boolean>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ it('action-sheet: alertFromActionSheet', async () => {
});

const presentBtn = await page.find('#alertFromActionSheet');
await presentBtn.click();
presentBtn.click();

const actionSheet = await page.find('ion-action-sheet');
await actionSheet.waitForVisible();
Expand All @@ -15,7 +15,7 @@ it('action-sheet: alertFromActionSheet', async () => {
expect(compare).toMatchScreenshot();

const openAlertBtn = await page.find({ text: 'Open Alert' });
await openAlertBtn.click();
openAlertBtn.click();

const alert = await page.find('ion-alert');
await alert.waitForVisible();
Expand All @@ -24,7 +24,7 @@ it('action-sheet: alertFromActionSheet', async () => {
expect(compare).toMatchScreenshot();

const alertOkayBtn = await page.find({ contains: 'Okay' });
await alertOkayBtn.click();
alertOkayBtn.click();

await Promise.all([
alert.waitForNotVisible(),
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/action-sheet/test/basic/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ it('action-sheet: basic', async () => {
});

const presentBtn = await page.find('#basic');
await presentBtn.click();
presentBtn.click();

let actionSheet = await page.find('ion-action-sheet');
await actionSheet.waitForVisible();
Expand All @@ -15,7 +15,7 @@ it('action-sheet: basic', async () => {
expect(compare).toMatchScreenshot();

const backdrop = await page.find('ion-backdrop');
await backdrop.click();
backdrop.click();

await actionSheet.waitForNotVisible();

Expand Down
2 changes: 1 addition & 1 deletion core/src/components/action-sheet/test/cancel-only/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ it('action-sheet: cancelOnly', async () => {
});

const presentBtn = await page.find('#cancelOnly');
await presentBtn.click();
presentBtn.click();

const actionSheet = await page.find('ion-action-sheet');
await actionSheet.waitForVisible();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/action-sheet/test/custom-css/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ it('action-sheet: cssClass', async () => {
});

const presentBtn = await page.find('#cssClass');
await presentBtn.click();
presentBtn.click();

const actionSheet = await page.find('ion-action-sheet');
await actionSheet.waitForVisible();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/action-sheet/test/icons/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ it('action-sheet: icons', async () => {
});

const presentBtn = await page.find('#icons');
await presentBtn.click();
presentBtn.click();

const actionSheet = await page.find('ion-action-sheet');
await actionSheet.waitForVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ it('action-sheet: noBackdropDismiss', async () => {
});

const presentBtn = await page.find('#noBackdropDismiss');
await presentBtn.click();
presentBtn.click();

let actionSheet = await page.find('ion-action-sheet');
await actionSheet.waitForVisible();
Expand All @@ -15,7 +15,7 @@ it('action-sheet: noBackdropDismiss', async () => {
expect(compare).toMatchScreenshot();

const backdrop = await page.find('ion-backdrop');
await backdrop.click();
backdrop.click();

compare = await page.compareScreenshot(`dismissed`);
expect(compare).toMatchScreenshot();
Expand All @@ -24,7 +24,7 @@ it('action-sheet: noBackdropDismiss', async () => {
expect(isVisible).toBe(true);

const cancel = await page.find('.action-sheet-cancel');
await cancel.click();
cancel.click();

await actionSheet.waitForNotVisible();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ it('action-sheet: scrollWithoutCancel', async () => {
});

const presentBtn = await page.find('#scrollWithoutCancel');
await presentBtn.click();
presentBtn.click();

const actionSheet = await page.find('ion-action-sheet');
await actionSheet.waitForVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ it('action-sheet: scrollableOptions', async () => {
});

const presentBtn = await page.find('#scrollableOptions');
await presentBtn.click();
presentBtn.click();

const actionSheet = await page.find('ion-action-sheet');
await actionSheet.waitForVisible();
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class Alert implements ComponentInterface, OverlayInterface {
type: i.type || 'text',
name: i.name || `${index}`,
placeholder: i.placeholder || '',
value: (i.value != null) ? i.value : '',
value: i.value || '',
label: i.label,
checked: !!i.checked,
disabled: !!i.disabled,
Expand Down
1 change: 0 additions & 1 deletion core/src/components/datetime/datetime.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

:host {
--placeholder-color: #{$datetime-ios-placeholder-color};

--padding-top: #{$datetime-ios-padding-top};
--padding-end: #{$datetime-ios-padding-end};
--padding-bottom: #{$datetime-ios-padding-bottom};
Expand Down
1 change: 0 additions & 1 deletion core/src/components/datetime/datetime.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

:host {
--placeholder-color: #{$datetime-md-placeholder-color};

--padding-top: #{$datetime-md-padding-top};
--padding-end: #{$datetime-md-padding-end};
--padding-bottom: #{$datetime-md-padding-bottom};
Expand Down
6 changes: 3 additions & 3 deletions core/src/components/datetime/datetime.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
display: flex;
position: relative;

min-width: $datetime-min-width;
min-height: $datetime-min-height;

font-family: $font-family-base;

text-overflow: ellipsis;

white-space: nowrap;

min-width: $datetime-min-width;
min-height: $datetime-min-height;

overflow: hidden;
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/components/datetime/datetime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Datetime implements ComponentInterface {

@Element() el!: HTMLIonDatetimeElement;

@State() text?: string;
@State() text?: string | null;

@Prop({ connect: 'ion-picker-controller' }) pickerCtrl!: HTMLIonPickerControllerElement;

Expand Down Expand Up @@ -174,7 +174,7 @@ export class Datetime implements ComponentInterface {
* The text to display when there's no date selected yet.
* Using lowercase to match the input attribute
*/
@Prop() placeholder?: string;
@Prop() placeholder?: string | null;

/**
* the value of the datetime.
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/datetime/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ dates in JavaScript.
| `monthValues` | -- | Values used to create the list of selectable months. By default the month values range from `1` to `12`. However, to control exactly which months to display, the `monthValues` input can take a number, an array of numbers, or a string of comma separated numbers. For example, if only summer months should be shown, then this input value would be `monthValues="6,7,8"`. Note that month numbers do *not* have a zero-based index, meaning January's value is `1`, and December's is `12`. | `number[]`, `number`, `string` |
| `pickerFormat` | `picker-format` | The format of the date and time picker columns the user selects. A datetime input can have one or many datetime parts, each getting their own column which allow individual selection of that particular datetime part. For example, year and month columns are two individually selectable columns which help choose an exact date from the datetime picker. Each column follows the string parse format. Defaults to use `displayFormat`. | `string` |
| `pickerOptions` | -- | Any additional options that the picker interface can accept. See the [Picker API docs](../../picker/Picker) for the picker options. | `PickerOptions` |
| `placeholder` | `placeholder` | The text to display when there's no date selected yet. Using lowercase to match the input attribute | `string` |
| `placeholder` | `placeholder` | The text to display when there's no date selected yet. Using lowercase to match the input attribute | `string`, `null` |
| `value` | -- | the value of the datetime. | `any` |
| `yearValues` | -- | Values used to create the list of selectable years. By default the year values range between the `min` and `max` datetime inputs. However, to control exactly which years to display, the `yearValues` input can take a number, an array of numbers, or string of comma separated numbers. For example, to show upcoming and recent leap years, then this input's value would be `yearValues="2024,2020,2016,2012,2008"`. | `number[]`, `number`, `string` |

Expand Down
4 changes: 2 additions & 2 deletions core/src/components/select/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ Since select uses the alert, action sheet and popover interfaces, options can be
| `multiple` | `multiple` | If true, the select can accept multiple values. | `boolean` |
| `name` | `name` | The name of the control, which is submitted with the form data. | `string` |
| `okText` | `ok-text` | The text to display on the ok button. Default: `OK`. | `string` |
| `placeholder` | `placeholder` | The text to display when the select is empty. | `string` |
| `selectedText` | `selected-text` | The text to display instead of the selected option's value. | `string` |
| `placeholder` | `placeholder` | The text to display when the select is empty. | `string`, `null` |
| `selectedText` | `selected-text` | The text to display instead of the selected option's value. | `string`, `null` |
| `value` | -- | the value of the select. | `any`, `null` |


Expand Down
6 changes: 3 additions & 3 deletions core/src/components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class Select implements ComponentInterface {

@State() isExpanded = false;
@State() keyFocus = false;
@State() text?: string;
@State() text?: string | null;

/**
* The mode determines which platform styles to use.
Expand All @@ -53,7 +53,7 @@ export class Select implements ComponentInterface {
/**
* The text to display when the select is empty.
*/
@Prop() placeholder?: string;
@Prop() placeholder?: string | null;

/**
* The name of the control, which is submitted with the form data.
Expand All @@ -63,7 +63,7 @@ export class Select implements ComponentInterface {
/**
* The text to display instead of the selected option's value.
*/
@Prop() selectedText?: string;
@Prop() selectedText?: string | null;

/**
* If true, the select can accept multiple values.
Expand Down
4 changes: 2 additions & 2 deletions core/src/utils/input-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export interface InputChangeEvent {
}

export interface SelectInputChangeEvent {
value: any | any[] | undefined;
text: string | undefined;
value: any | any[] | undefined | null;
text: string | undefined | null;
}

export interface StyleEvent {
Expand Down
22 changes: 9 additions & 13 deletions core/src/utils/overlays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,24 @@ export function createOverlay<T extends HTMLIonOverlayElement>(element: T, opts:
return element.componentOnReady();
}

function closeTopOverlay(doc: Document) {
const lastOverlay = getOverlay(doc);
if (lastOverlay && lastOverlay.backdropDismiss) {
return lastOverlay.dismiss(undefined, BACKDROP);
}
return Promise.resolve();
}

export function connectListeners(doc: Document) {
if (lastId === 0) {
lastId = 1;
doc.addEventListener('ionBackButton', ev => {
const lastOverlay = getOverlay(doc);
// We use the overlayIndex property to be sure this node is an overlay
if (lastOverlay && lastOverlay.overlayIndex) {
(ev as BackButtonEvent).detail.register(100, () => closeTopOverlay(doc));
if (lastOverlay && lastOverlay.backdropDismiss) {
(ev as BackButtonEvent).detail.register(100, () => {
return lastOverlay.dismiss(undefined, BACKDROP);
});
}
});

doc.addEventListener('keyup', ev => {
if (ev.key === 'Escape') {
closeTopOverlay(doc);
const lastOverlay = getOverlay(doc);
if (lastOverlay && lastOverlay.backdropDismiss) {
lastOverlay.dismiss(undefined, BACKDROP);
}
}
});
}
Expand All @@ -58,7 +54,7 @@ export function dismissOverlay(doc: Document, data: any, role: string | undefine
}

export function getOverlays(doc: Document, overlayTag?: string): HTMLIonOverlayElement[] {
const overlays = Array.from(getAppRoot(doc).children) as HTMLIonOverlayElement[];
const overlays = (Array.from(getAppRoot(doc).children) as HTMLIonOverlayElement[]).filter(c => c.overlayIndex > 0);
if (overlayTag === undefined) {
return overlays;
}
Expand Down

0 comments on commit f8eafa7

Please sign in to comment.