-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(angular): picker controller uses correct core instance (#28521)
Issue number: Internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? As a takeaway from our learning session about a menuController bug in Ionic Angular, the team would like to update our other providers to use the same architecture as the menuController to prevent this kind of issue from happening again in the future. We also noticed that the common provider does not provide much value and it's easier to just have two separate implementations in `src` and `standalone`. (There wasn't much code we could de-duplicate) ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Removed the common picker provider in favor of separate ones in src/standalone ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
- Loading branch information
1 parent
f143bd0
commit 9d57758
Showing
11 changed files
with
71 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { OverlayBaseController } from '@ionic/angular/common'; | ||
import type { PickerOptions } from '@ionic/core'; | ||
import { pickerController } from '@ionic/core'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class PickerController extends OverlayBaseController<PickerOptions, HTMLIonPickerElement> { | ||
constructor() { | ||
super(pickerController); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
...common/src/providers/picker-controller.ts → ...dalone/src/providers/picker-controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { OverlayBaseController } from '@ionic/angular/common'; | ||
import type { PickerOptions } from '@ionic/core/components'; | ||
import { pickerController } from '@ionic/core/components'; | ||
|
||
import { OverlayBaseController } from '../utils/overlay'; | ||
import { defineCustomElement } from '@ionic/core/components/ion-picker.js'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class PickerController extends OverlayBaseController<PickerOptions, HTMLIonPickerElement> { | ||
constructor() { | ||
super(pickerController); | ||
|
||
// TODO: FW-5415 may remove the need for this | ||
defineCustomElement(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
packages/angular/test/base/e2e/src/standalone/overlay-controllers.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
describe('Overlay Controllers', () => { | ||
beforeEach(() => { | ||
cy.visit('/standalone/overlay-controllers'); | ||
}) | ||
}); | ||
|
||
it('should present a modal', () => { | ||
cy.get('button#open-modal').click(); | ||
|
||
cy.get('ion-modal app-dialog-content').should('be.visible'); | ||
}); | ||
|
||
it('should present a picker', () => { | ||
cy.get('button#open-picker').click(); | ||
|
||
cy.get('ion-picker .picker-button').should('be.visible'); | ||
}); | ||
|
||
it('should present a popover', () => { | ||
cy.get('button#open-popover').click(); | ||
|
||
cy.get('ion-popover app-dialog-content').should('be.visible'); | ||
}); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...gular/test/base/src/app/standalone/overlay-controllers/overlay-controllers.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<div> | ||
<button id="open-modal" (click)="openModal()">Open Modal</button> | ||
<button id="open-picker" (click)="openPicker()">Open Picker</button> | ||
<button id="open-popover" (click)="openPopover($event)">Open Popover</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters