File tree Expand file tree Collapse file tree
app/frontend/tests/unit/components/designer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1912,6 +1912,58 @@ describe('FormViewer.vue', () => {
19121912 expect ( errMsg ) . toBeUndefined ( ) ;
19131913 expect ( updateSubmissionSpy ) . toBeCalledTimes ( 1 ) ;
19141914 } ) ;
1915+
1916+ it ( 'renders FormViewerActions when expired and read-only' , async ( ) => {
1917+ const wrapper = shallowMount ( FormViewer , {
1918+ props : {
1919+ formId,
1920+ submissionId : '123' ,
1921+ readOnly : true ,
1922+ } ,
1923+ global : {
1924+ provide : {
1925+ setWideLayout : vi . fn ( ) ,
1926+ } ,
1927+ plugins : [ pinia ] ,
1928+ stubs : STUBS ,
1929+ } ,
1930+ } ) ;
1931+
1932+ await flushPromises ( ) ;
1933+
1934+ wrapper . vm . isFormScheduleExpired = true ;
1935+ wrapper . vm . isLateSubmissionAllowed = false ;
1936+
1937+ await wrapper . vm . $nextTick ( ) ;
1938+
1939+ expect ( wrapper . findComponent ( { name : 'Form' } ) . exists ( ) ) . toBe ( true ) ;
1940+ } ) ;
1941+
1942+ it ( 'does not render FormViewerActions when expired and editable' , async ( ) => {
1943+ const wrapper = shallowMount ( FormViewer , {
1944+ props : {
1945+ formId,
1946+ submissionId : '123' ,
1947+ readOnly : false ,
1948+ } ,
1949+ global : {
1950+ provide : {
1951+ setWideLayout : vi . fn ( ) ,
1952+ } ,
1953+ plugins : [ pinia ] ,
1954+ stubs : STUBS ,
1955+ } ,
1956+ } ) ;
1957+
1958+ await flushPromises ( ) ;
1959+
1960+ wrapper . vm . isFormScheduleExpired = true ;
1961+ wrapper . vm . isLateSubmissionAllowed = false ;
1962+
1963+ await wrapper . vm . $nextTick ( ) ;
1964+
1965+ expect ( wrapper . findComponent ( { name : 'Form' } ) . exists ( ) ) . toBe ( false ) ;
1966+ } ) ;
19151967 } ) ;
19161968
19171969 it ( 'extractSubmissionData returns response.data when submissionId exists and isDuplicate is true' , async ( ) => {
You can’t perform that action at this time.
0 commit comments