diff --git a/packages/app/src/specs/CreateSpecModal.cy.tsx b/packages/app/src/specs/CreateSpecModal.cy.tsx
index ea0b567c83ae..2b79f7108c3f 100644
--- a/packages/app/src/specs/CreateSpecModal.cy.tsx
+++ b/packages/app/src/specs/CreateSpecModal.cy.tsx
@@ -64,6 +64,94 @@ describe('', () => {
})
})
+describe('Modal Text Input', () => {
+ it('focuses text input and selects file name by default', () => {
+ const show = ref(true)
+
+ cy.mount(() => (
+ show.value = false}
+ />
+
))
+
+ cy.focused().as('specNameInput')
+
+ // focused should yield the input element since it should be auto-focused
+ cy.get('@specNameInput').invoke('val').should('equal', 'cypress/e2e/ComponentName.cy.js')
+
+ // only the file name should be focused, so backspacing should erase the whole file name
+ cy.get('@specNameInput').type('{backspace}')
+
+ cy.get('@specNameInput').invoke('val').should('equal', 'cypress/e2e/.cy.js')
+ })
+
+ it('focuses text input but does not select if default file name does not match regex', () => {
+ const show = ref(true)
+
+ cy.mount(() => (
+ show.value = false}
+ />
+
))
+
+ cy.focused().as('specNameInput')
+
+ // focused should yield the input element since it should be auto-focused
+ cy.get('@specNameInput').invoke('val').should('equal', 'this/path/does/not/produce/regex/match-')
+
+ // nothing should be selected, so backspacing should only delete the last character in the file path
+ cy.get('@specNameInput').type('{backspace}')
+
+ cy.get('@specNameInput').invoke('val').should('equal', 'this/path/does/not/produce/regex/match')
+ })
+})
+
describe('playground', () => {
it('can be opened and closed via the show prop', () => {
const show = ref(false)
diff --git a/packages/app/src/specs/generators/EmptyGenerator.vue b/packages/app/src/specs/generators/EmptyGenerator.vue
index ff54e2b1bf65..e06ab095568a 100644
--- a/packages/app/src/specs/generators/EmptyGenerator.vue
+++ b/packages/app/src/specs/generators/EmptyGenerator.vue
@@ -4,6 +4,7 @@