File tree Expand file tree Collapse file tree 3 files changed +143
-110
lines changed Expand file tree Collapse file tree 3 files changed +143
-110
lines changed Original file line number Diff line number Diff line change 1+ /* Ionic Hooks and components */
2+
3+ // If you are about to add a hook or component to one of the array below, please do so
4+ // in alphabetical order. This makes it easier to find and check if certain hooks & components are there
5+
6+ export const IonicHooks = [
7+ 'createAnimation' ,
8+ 'createGesture' ,
9+ 'getPlatforms' ,
10+ 'getTimeGivenProgression' ,
11+ 'iosTransitionAnimation' ,
12+ 'isPlatform' ,
13+ 'mdTransitionAnimation' ,
14+ 'menuController' ,
15+ 'onIonViewDidEnter' ,
16+ 'onIonViewDidLeave' ,
17+ 'onIonViewWillEnter' ,
18+ 'onIonViewWillLeave' ,
19+ 'useBackButton' ,
20+ 'useIonRouter' ,
21+ 'useKeyboard' ,
22+ ]
23+
24+ export const IonicBuiltInComponents = [
25+ 'IonAccordion' ,
26+ 'IonAccordionGroup' ,
27+ 'IonActionSheet' ,
28+ 'IonAlert' ,
29+ 'IonApp' ,
30+ 'IonAvatar' ,
31+ 'IonBackButton' ,
32+ 'IonBackdrop' ,
33+ 'IonBadge' ,
34+ 'IonBreadcrumb' ,
35+ 'IonBreadcrumbs' ,
36+ 'IonButton' ,
37+ 'IonButtons' ,
38+ 'IonCard' ,
39+ 'IonCardContent' ,
40+ 'IonCardHeader' ,
41+ 'IonCardSubtitle' ,
42+ 'IonCardTitle' ,
43+ 'IonCheckbox' ,
44+ 'IonChip' ,
45+ 'IonCol' ,
46+ 'IonContent' ,
47+ 'IonDatetime' ,
48+ 'IonDatetimeButton' ,
49+ 'IonFab' ,
50+ 'IonFabButton' ,
51+ 'IonFabList' ,
52+ 'IonFooter' ,
53+ 'IonGrid' ,
54+ 'IonHeader' ,
55+ 'IonIcon' ,
56+ 'IonImg' ,
57+ 'IonInfiniteScroll' ,
58+ 'IonInfiniteScrollContent' ,
59+ 'IonInput' ,
60+ 'IonItem' ,
61+ 'IonItemDivider' ,
62+ 'IonItemGroup' ,
63+ 'IonItemOption' ,
64+ 'IonItemOptions' ,
65+ 'IonItemSliding' ,
66+ 'IonLabel' ,
67+ 'IonList' ,
68+ 'IonListHeader' ,
69+ 'IonLoading' ,
70+ 'IonMenu' ,
71+ 'IonMenuButton' ,
72+ 'IonMenuToggle' ,
73+ 'IonModal' ,
74+ 'IonNav' ,
75+ 'IonNavLink' ,
76+ 'IonNote' ,
77+ 'IonPage' ,
78+ 'IonPicker' ,
79+ 'IonPopover' ,
80+ 'IonProgressBar' ,
81+ 'IonRadio' ,
82+ 'IonRadioGroup' ,
83+ 'IonRange' ,
84+ 'IonRefresher' ,
85+ 'IonRefresherContent' ,
86+ 'IonReorder' ,
87+ 'IonReorderGroup' ,
88+ 'IonRippleEffect' ,
89+ 'IonRouterOutlet' ,
90+ 'IonRow' ,
91+ 'IonSearchbar' ,
92+ 'IonSegment' ,
93+ 'IonSegmentButton' ,
94+ 'IonSelect' ,
95+ 'IonSelectOption' ,
96+ 'IonSkeletonText' ,
97+ 'IonSpinner' ,
98+ 'IonSplitPane' ,
99+ 'IonTabBar' ,
100+ 'IonTabButton' ,
101+ 'IonTabs' ,
102+ 'IonText' ,
103+ 'IonTextarea' ,
104+ 'IonThumbnail' ,
105+ 'IonTitle' ,
106+ 'IonToast' ,
107+ 'IonToggle' ,
108+ 'IonToolbar' ,
109+ ]
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { readPackageJSON } from 'pkg-types'
1212import { defineUnimportPreset } from 'unimport'
1313
1414import { runtimeDir } from './utils'
15+ import { IonicBuiltInComponents , IonicHooks } from './imports'
1516
1617import { setupUtilityComponents } from './parts/components'
1718import { useCSSSetup } from './parts/css'
@@ -184,113 +185,3 @@ export default defineNuxtModule<ModuleOptions>({
184185 }
185186 } ,
186187} )
187-
188- /* Ionic Hooks and components */
189-
190- // If you are about to add a hook or component to one of the array below, please do so
191- // in alphabetical order. This makes it easier to find and check if certain hooks & components are there
192-
193- const IonicHooks = [
194- 'createAnimation' ,
195- 'createGesture' ,
196- 'getPlatforms' ,
197- 'getTimeGivenProgression' ,
198- 'iosTransitionAnimation' ,
199- 'isPlatform' ,
200- 'mdTransitionAnimation' ,
201- 'menuController' ,
202- 'onIonViewDidEnter' ,
203- 'onIonViewDidLeave' ,
204- 'onIonViewWillEnter' ,
205- 'onIonViewWillLeave' ,
206- 'useBackButton' ,
207- 'useIonRouter' ,
208- 'useKeyboard' ,
209- ]
210-
211- const IonicBuiltInComponents = [
212- 'IonAccordion' ,
213- 'IonAccordionGroup' ,
214- 'IonActionSheet' ,
215- 'IonAlert' ,
216- 'IonApp' ,
217- 'IonAvatar' ,
218- 'IonBackButton' ,
219- 'IonBackdrop' ,
220- 'IonBadge' ,
221- 'IonBreadcrumb' ,
222- 'IonBreadcrumbs' ,
223- 'IonButton' ,
224- 'IonButtons' ,
225- 'IonCard' ,
226- 'IonCardContent' ,
227- 'IonCardHeader' ,
228- 'IonCardSubtitle' ,
229- 'IonCardTitle' ,
230- 'IonCheckbox' ,
231- 'IonChip' ,
232- 'IonCol' ,
233- 'IonContent' ,
234- 'IonDatetime' ,
235- 'IonDatetimeButton' ,
236- 'IonFab' ,
237- 'IonFabButton' ,
238- 'IonFabList' ,
239- 'IonFooter' ,
240- 'IonGrid' ,
241- 'IonHeader' ,
242- 'IonIcon' ,
243- 'IonImg' ,
244- 'IonInfiniteScroll' ,
245- 'IonInfiniteScrollContent' ,
246- 'IonInput' ,
247- 'IonItem' ,
248- 'IonItemDivider' ,
249- 'IonItemGroup' ,
250- 'IonItemOption' ,
251- 'IonItemOptions' ,
252- 'IonItemSliding' ,
253- 'IonLabel' ,
254- 'IonList' ,
255- 'IonListHeader' ,
256- 'IonLoading' ,
257- 'IonMenu' ,
258- 'IonMenuButton' ,
259- 'IonMenuToggle' ,
260- 'IonModal' ,
261- 'IonNav' ,
262- 'IonNavLink' ,
263- 'IonNote' ,
264- 'IonPage' ,
265- 'IonPicker' ,
266- 'IonPopover' ,
267- 'IonProgressBar' ,
268- 'IonRadio' ,
269- 'IonRadioGroup' ,
270- 'IonRange' ,
271- 'IonRefresher' ,
272- 'IonRefresherContent' ,
273- 'IonReorder' ,
274- 'IonReorderGroup' ,
275- 'IonRippleEffect' ,
276- 'IonRouterOutlet' ,
277- 'IonRow' ,
278- 'IonSearchbar' ,
279- 'IonSegment' ,
280- 'IonSegmentButton' ,
281- 'IonSelect' ,
282- 'IonSelectOption' ,
283- 'IonSkeletonText' ,
284- 'IonSpinner' ,
285- 'IonSplitPane' ,
286- 'IonTabBar' ,
287- 'IonTabButton' ,
288- 'IonTabs' ,
289- 'IonText' ,
290- 'IonTextarea' ,
291- 'IonThumbnail' ,
292- 'IonTitle' ,
293- 'IonToast' ,
294- 'IonToggle' ,
295- 'IonToolbar' ,
296- ]
Original file line number Diff line number Diff line change 1+ import { expect , describe , it } from 'vitest'
2+ import * as ionicVue from '@ionic/vue'
3+ import { IonicBuiltInComponents , IonicHooks } from '../../src/imports'
4+
5+ const ExportedHelpers = Object . keys ( ionicVue ) as Array < keyof typeof ionicVue >
6+ const RegisteredHelpers = [ ...IonicBuiltInComponents , ...IonicHooks ]
7+
8+ const ExcludedHelpers : Array < keyof typeof ionicVue > = [
9+ 'IonicSafeString' ,
10+ 'IonicSlides' ,
11+ 'IonicVue' ,
12+ 'actionSheetController' ,
13+ 'alertController' ,
14+ 'loadingController' ,
15+ 'modalController' ,
16+ 'pickerController' ,
17+ 'popoverController' ,
18+ 'toastController' ,
19+ ]
20+
21+ describe ( 'imports:ionic' , ( ) => {
22+ it ( 'should not register anything that is not exported' , ( ) => {
23+ for ( const helper of RegisteredHelpers ) {
24+ expect ( ExportedHelpers ) . toContain ( helper )
25+ }
26+ } )
27+ it ( 'should register everything that is exported' , ( ) => {
28+ for ( const helper of ExportedHelpers ) {
29+ if ( ExcludedHelpers . includes ( helper ) ) continue
30+ expect ( RegisteredHelpers ) . toContain ( helper )
31+ }
32+ } )
33+ } )
You can’t perform that action at this time.
0 commit comments