Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dirty_submit_form_spec.js « dirty_submit « javascripts « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a2ec332e9568a4020222c8afba6be74ef82b0516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

import DirtySubmitForm from '~/dirty_submit/dirty_submit_form';
import { setInput, createForm } from './helper';

describe('DirtySubmitForm', () => {
  it('disables submit until there are changes', done => {
    const { form, input, submit } = createForm();
    const originalValue = input.value;

    new DirtySubmitForm(form); // eslint-disable-line no-new

    expect(submit.disabled).toBe(true);

    return setInput(input, `${originalValue} changes`)
      .then(() => {
        expect(submit.disabled).toBe(false);
      })
      .then(() => setInput(input, originalValue))
      .then(() => {
        expect(submit.disabled).toBe(true);
      })
      .then(done)
      .catch(done.fail);
  });
});