diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-14 15:12:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-14 15:12:34 +0300 |
commit | 16daf112d6cfe2c87d8837382a00d88aa8c0ff5c (patch) | |
tree | 017d43acafea2928550fe7c8fdbb7cf36335ba9f /spec/frontend/access_tokens | |
parent | 3cb798d80b6b5235b5f5febaaacef410e75c2963 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/access_tokens')
-rw-r--r-- | spec/frontend/access_tokens/components/new_access_token_app_spec.js | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/spec/frontend/access_tokens/components/new_access_token_app_spec.js b/spec/frontend/access_tokens/components/new_access_token_app_spec.js index 9aaf2d310e6..d12d200d214 100644 --- a/spec/frontend/access_tokens/components/new_access_token_app_spec.js +++ b/spec/frontend/access_tokens/components/new_access_token_app_spec.js @@ -41,7 +41,7 @@ describe('~/access_tokens/components/new_access_token_app', () => { <input type="text" id="expires_at" value="2022-01-01"/> <input type="text" value='1'/> <input type="checkbox" checked/> - <input type="submit"/> + <input type="submit" value="Create"/> </form>`, ); @@ -102,15 +102,29 @@ describe('~/access_tokens/components/new_access_token_app', () => { }); }); - it('should reset all input fields except the date', async () => { - expect(document.querySelector('input[type=text][id$=expires_at]').value).toBe('2022-01-01'); - expect(document.querySelector('input[type=text]:not([id$=expires_at])').value).toBe('1'); - expect(document.querySelector('input[type=checkbox]').checked).toBe(true); - await triggerSuccess(); + describe('when resetting the form', () => { + it('should reset selectively some input fields', async () => { + expect(document.querySelector('input[type=text]:not([id$=expires_at])').value).toBe('1'); + expect(document.querySelector('input[type=checkbox]').checked).toBe(true); + await triggerSuccess(); + + expect(document.querySelector('input[type=text]:not([id$=expires_at])').value).toBe(''); + expect(document.querySelector('input[type=checkbox]').checked).toBe(false); + }); + + it('should not reset the date field', async () => { + expect(document.querySelector('input[type=text][id$=expires_at]').value).toBe('2022-01-01'); + await triggerSuccess(); - expect(document.querySelector('input[type=text][id$=expires_at]').value).toBe('2022-01-01'); - expect(document.querySelector('input[type=text]:not([id$=expires_at])').value).toBe(''); - expect(document.querySelector('input[type=checkbox]').checked).toBe(false); + expect(document.querySelector('input[type=text][id$=expires_at]').value).toBe('2022-01-01'); + }); + + it('should not reset the submit button value', async () => { + expect(document.querySelector('input[type=submit]').value).toBe('Create'); + await triggerSuccess(); + + expect(document.querySelector('input[type=submit]').value).toBe('Create'); + }); }); }); |