@@ -34,6 +34,7 @@ describe('Manifest Utils', () => {
3434 describe ( 'generateManifest' , ( ) => {
3535 describe ( 'popup' , ( ) => {
3636 type ActionType = 'browser_action' | 'page_action' ;
37+ type Mv3ActionType = 'action' | 'page_action' ;
3738 const popupEntrypoint = ( type ?: ActionType ) =>
3839 fakePopupEntrypoint ( {
3940 options : {
@@ -107,29 +108,39 @@ describe('Manifest Utils', () => {
107108 } ,
108109 ) ;
109110
110- it ( 'should allow converting action to page_action for Firefox MV3' , async ( ) => {
111- const popup = popupEntrypoint ( 'page_action' ) ;
112- const buildOutput = fakeBuildOutput ( ) ;
113- setFakeWxt ( {
114- config : {
115- manifestVersion : 3 ,
116- outDir,
117- browser : 'firefox' ,
118- } ,
119- } ) ;
120- const expected = {
121- default_icon : popup . options . defaultIcon ,
122- default_title : popup . options . defaultTitle ,
123- default_popup : 'popup.html' ,
124- } ;
111+ it . each < {
112+ inputType : ActionType | undefined ;
113+ expectedType : Mv3ActionType ;
114+ } > ( [
115+ { inputType : undefined , expectedType : 'action' } ,
116+ { inputType : 'browser_action' , expectedType : 'action' } ,
117+ { inputType : 'page_action' , expectedType : 'page_action' } ,
118+ ] ) (
119+ 'should use the correct action for Firefox in mv3: %j' ,
120+ async ( { inputType, expectedType } ) => {
121+ const popup = popupEntrypoint ( inputType ) ;
122+ const buildOutput = fakeBuildOutput ( ) ;
123+ setFakeWxt ( {
124+ config : {
125+ manifestVersion : 3 ,
126+ outDir,
127+ browser : 'firefox' ,
128+ } ,
129+ } ) ;
130+ const expected = {
131+ default_icon : popup . options . defaultIcon ,
132+ default_title : popup . options . defaultTitle ,
133+ default_popup : 'popup.html' ,
134+ } ;
125135
126- const { manifest : actual } = await generateManifest (
127- [ popup ] ,
128- buildOutput ,
129- ) ;
136+ const { manifest : actual } = await generateManifest (
137+ [ popup ] ,
138+ buildOutput ,
139+ ) ;
130140
131- expect ( actual . page_action ) . toEqual ( expected ) ;
132- } ) ;
141+ expect ( actual [ expectedType ] ) . toEqual ( expected ) ;
142+ } ,
143+ ) ;
133144
134145 it ( 'should include default_area for Firefox in mv3' , async ( ) => {
135146 const popup = fakePopupEntrypoint ( {
0 commit comments