@@ -31,13 +31,18 @@ jest.mock('react-i18next', () => ({
3131 return {
3232 t : ( str : string ) => str ,
3333 i18n : {
34- changeLanguage : ( ) => new Promise ( ( ) => { } ) ,
34+ changeLanguage : ( ) =>
35+ new Promise ( ( ) => {
36+ // satisfy linter - by making it uglier? ¯\_(ツ)_/¯
37+ } ) ,
3538 } ,
3639 }
3740 } ,
3841 initReactI18next : {
3942 type : '3rdParty' ,
40- init : ( ) => { } ,
43+ init : ( ) => {
44+ // satisfy linter - by making it uglier? ¯\_(ツ)_/¯
45+ } ,
4146 } ,
4247} ) )
4348
@@ -164,6 +169,9 @@ jest.mock('../../../lib/meteorApi', () => ({
164169jest . mock ( '../../../lib/forms/SchemaFormInPlace' , ( ) => ( {
165170 SchemaFormInPlace : ( ) => < div data-testid = "schema-form" > Schema Form</ div > ,
166171} ) )
172+ jest . mock ( '../../../lib/forms/SchemaFormWithState' , ( ) => ( {
173+ SchemaFormWithState : ( ) => < div data-testid = "schema-form" > Schema Form</ div > ,
174+ } ) )
167175
168176describe ( 'PropertiesPanel' , ( ) => {
169177 const wrapper = ( { children } : { children : React . ReactNode } ) => (
@@ -206,6 +214,18 @@ describe('PropertiesPanel', () => {
206214 svgIcon : '<svg></svg>' ,
207215 } ,
208216 ] ,
217+ userEditProperties : {
218+ operations : [
219+ {
220+ id : 'operation1' ,
221+ label : { key : 'TEST_LABEL' , namespaces : [ 'blueprint_main-showstyle' ] } ,
222+ type : UserEditingType . ACTION ,
223+ isActive : false ,
224+ svgIcon : '<svg></svg>' ,
225+ } ,
226+ ] ,
227+ translationNamespaces : [ 'blueprint_main-showstyle' ] ,
228+ } ,
209229 isHidden : false ,
210230 } )
211231
@@ -230,7 +250,7 @@ describe('PropertiesPanel', () => {
230250 test ( 'renders empty when no element selected' , ( ) => {
231251 const { container } = render ( < PropertiesPanel /> , { wrapper } )
232252 expect ( container . querySelector ( '.properties-panel' ) ) . toBeTruthy ( )
233- expect ( container . querySelector ( '.propertiespanel- pop-up__contents ' ) ) . toBeFalsy ( )
253+ expect ( container . querySelector ( '.properties-panel- pop-up__form ' ) ) . toBeFalsy ( )
234254 } )
235255
236256 test ( 'renders segment properties when segment is selected' , async ( ) => {
@@ -308,8 +328,8 @@ describe('PropertiesPanel', () => {
308328 } )
309329
310330 // Wait for the switch button to be available
311- const { container } = renderWithContext ( < PropertiesPanel /> , { ctxValue : result . current } )
312- const switchButton = await waitFor ( ( ) => container . querySelector ( '.propertiespanel-pop-up__switchbutton ') )
331+ renderWithContext ( < PropertiesPanel /> , { ctxValue : result . current } )
332+ const switchButton = await waitFor ( ( ) => screen . getByText ( 'TEST_LABEL ') )
313333 expect ( switchButton ) . toBeTruthy ( )
314334
315335 if ( ! switchButton ) return // above would have thrown - this is a type guard
@@ -318,7 +338,7 @@ describe('PropertiesPanel', () => {
318338 await userEvent . click ( switchButton )
319339
320340 // Check if commit button is enabled
321- const commitButton = screen . getByText ( 'COMMIT CHANGES ' )
341+ const commitButton = screen . getByText ( 'Save ' )
322342 expect ( commitButton ) . toBeEnabled ( )
323343
324344 // Commit changes
@@ -366,7 +386,7 @@ describe('PropertiesPanel', () => {
366386 } )
367387
368388 // Click revert button
369- const revertButton = screen . getByText ( 'REVERT CHANGES ' )
389+ const revertButton = screen . getByText ( 'Restore Segment from NRCS ' )
370390 await act ( async ( ) => {
371391 await userEvent . click ( revertButton )
372392 } )
@@ -381,7 +401,7 @@ describe('PropertiesPanel', () => {
381401 pieceExternalId : undefined ,
382402 } ,
383403 {
384- id : 'revert-segment' ,
404+ id : '__sofie- revert-segment' ,
385405 }
386406 )
387407 } )
@@ -407,6 +427,7 @@ describe('PropertiesPanel', () => {
407427 await userEvent . click ( closeButton ! )
408428 } )
409429
410- expect ( container . querySelector ( '.propertiespanel-pop-up__contents' ) ) . toBeFalsy ( )
430+ // expect(container.querySelector('.propertiespanel-pop-up__contents')).toBeFalsy()
431+ expect ( container . querySelector ( '.properties-panel-pop-up__form' ) ) . toBeFalsy ( )
411432 } )
412433} )
0 commit comments