Skip to content

Commit

Permalink
chore: upgrade jest to incorporate jsdom bugfix (#5456)
Browse files Browse the repository at this point in the history
* chore: upgrade jest

* test: adjust for new document.activeElement behavior in jsdom

* test: clean up container div

Co-authored-by: Josh Black <[email protected]>
  • Loading branch information
emyarod and joshblack committed Mar 10, 2020
1 parent 1f0bd70 commit 8efe541
Show file tree
Hide file tree
Showing 106 changed files with 872 additions and 287 deletions.
Binary file not shown.
Binary file added .yarn/offline-mirror/@bcoe-v8-coverage-0.2.3.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/@jest-console-25.1.0.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/@jest-core-24.9.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/@jest-core-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/@jest-environment-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/@jest-fake-timers-25.1.0.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/@jest-reporters-24.9.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/@jest-reporters-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/@jest-source-map-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/@jest-test-result-25.1.0.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/@jest-test-sequencer-24.9.0.tgz
Binary file not shown.
Binary file not shown.
Binary file added .yarn/offline-mirror/@jest-transform-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/@jest-types-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/@types-yargs-15.0.4.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/babel-jest-25.1.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .yarn/offline-mirror/cssom-0.4.4.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/cssstyle-2.2.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/detect-newline-3.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/diff-sequences-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/escodegen-1.14.1.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/execa-3.4.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/expect-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/human-signals-1.1.1.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/import-local-3.0.2.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/istanbul-lib-report-2.0.8.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/offline-mirror/istanbul-reports-2.2.7.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/istanbul-reports-3.0.0.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/jest-24.9.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-25.1.0.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/jest-changed-files-24.9.0.tgz
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/offline-mirror/jest-cli-24.9.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-cli-25.1.0.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/jest-config-24.9.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-config-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-diff-25.1.0.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/jest-docblock-24.9.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-docblock-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-each-25.1.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-get-type-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-haste-map-25.1.0.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/jest-jasmine2-24.9.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-jasmine2-25.1.0.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/jest-leak-detector-24.9.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-message-util-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-mock-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-regex-util-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-resolve-25.1.0.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/offline-mirror/jest-runner-24.9.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-runner-25.1.0.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/jest-runtime-24.9.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-runtime-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-serializer-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-snapshot-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-util-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-validate-25.1.0.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/jest-watcher-24.9.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-watcher-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jest-worker-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/jsdom-15.2.1.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/node-notifier-5.4.3.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/node-notifier-6.0.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/npm-run-path-4.0.1.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/p-each-series-1.0.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/p-each-series-2.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/parse5-5.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/pretty-format-25.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/resolve-cwd-3.0.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/saxes-3.1.11.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/semver-7.1.3.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/source-map-0.7.3.tgz
Binary file not shown.
Binary file removed .yarn/offline-mirror/string-length-2.0.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/string-length-3.1.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/strip-bom-4.0.0.tgz
Binary file not shown.
Binary file not shown.
Binary file added .yarn/offline-mirror/terminal-link-2.1.1.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/throat-5.0.0.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/tough-cookie-3.0.1.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/v8-to-istanbul-4.1.2.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/w3c-xmlserializer-1.1.2.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/write-file-atomic-3.0.3.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/ws-7.2.1.tgz
Binary file not shown.
Binary file added .yarn/offline-mirror/xmlchars-2.2.0.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"fs-extra": "^8.1.0",
"glob": "^7.1.4",
"husky": "^4.0.10",
"jest": "^24.9.0",
"jest": "^25.1.0",
"jest-circus": "^24.9.0",
"jest-junit": "^10.0.0",
"lerna": "^3.20.2",
Expand Down
16 changes: 15 additions & 1 deletion packages/react/src/components/Checkbox/Checkbox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ describe('Checkbox', () => {
});

describe('refs', () => {
let container;

it('should accept refs', () => {
class MyComponent extends React.Component {
constructor(props) {
Expand All @@ -131,7 +133,12 @@ describe('refs', () => {
);
}
}
const wrapper = mount(<MyComponent />);
container = document.createElement('div');
container.id = 'container';
document.body.appendChild(container);
const wrapper = mount(<MyComponent />, {
attachTo: document.querySelector('#container'),
});
expect(document.activeElement.type).toBeUndefined();
wrapper.instance().focus();
expect(document.activeElement.type).toEqual('checkbox');
Expand All @@ -157,6 +164,13 @@ describe('refs', () => {
const wrapper = mount(<MyComponent />);
expect(wrapper.find('input').getDOMNode().indeterminate).toBe(true);
});

afterEach(() => {
if (container && container.parentNode) {
container.parentNode.removeChild(container);
}
container = null;
});
});

describe('CheckboxSkeleton', () => {
Expand Down
21 changes: 19 additions & 2 deletions packages/react/src/components/ComposedModal/ComposedModal-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ describe('<ModalFooter />', () => {
});

describe('<ComposedModal />', () => {
let container;

it('renders', () => {
const wrapper = mount(<ComposedModal open />);
expect(wrapper).toMatchSnapshot();
Expand Down Expand Up @@ -214,25 +216,40 @@ describe('<ComposedModal />', () => {
});

it('should focus on the primary actionable button in ModalFooter by default', () => {
container = document.createElement('div');
container.id = 'container';
document.body.appendChild(container);
mount(
<ComposedModal open>
<ModalFooter primaryButtonText="Save" />
</ComposedModal>
</ComposedModal>,
{ attachTo: document.querySelector('#container') }
);
expect(
document.activeElement.classList.contains(`${prefix}--btn--primary`)
).toEqual(true);
});

it('should focus on the element that matches selectorPrimaryFocus', () => {
container = document.createElement('div');
container.id = 'container';
document.body.appendChild(container);
mount(
<ComposedModal open selectorPrimaryFocus={`.${prefix}--modal-close`}>
<ModalHeader label="Optional Label" title="Example" />
<ModalFooter primaryButtonText="Save" />
</ComposedModal>
</ComposedModal>,
{ attachTo: document.querySelector('#container') }
);
expect(
document.activeElement.classList.contains(`${prefix}--modal-close`)
).toEqual(true);
});

afterEach(() => {
if (container && container.parentNode) {
container.parentNode.removeChild(container);
}
container = null;
});
});
16 changes: 15 additions & 1 deletion packages/react/src/components/Select/Select-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ describe('Select', () => {
});

describe('refs', () => {
let container;

it('should accept refs', () => {
class MyComponent extends React.Component {
constructor(props) {
Expand All @@ -164,11 +166,23 @@ describe('refs', () => {
return <Select id="test" labelText="testlabel" ref={this.myRef} />;
}
}
const wrapper = mount(<MyComponent />);
container = document.createElement('div');
container.id = 'container';
document.body.appendChild(container);
const wrapper = mount(<MyComponent />, {
attachTo: document.querySelector('#container'),
});
expect(document.activeElement.type).toBeUndefined();
wrapper.instance().focus();
expect(document.activeElement.type).toEqual('select-one');
});

afterEach(() => {
if (container && container.parentNode) {
container.parentNode.removeChild(container);
}
container = null;
});
});

describe('SelectSkeleton', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ describe('TextInput', () => {
const textInput = () => wrapper.find('input');

describe('input', () => {
let container;

it('renders as expected', () => {
expect(textInput().length).toBe(1);
});
Expand All @@ -47,7 +49,12 @@ describe('TextInput', () => {
);
}
}
const wrapper = mount(<MyComponent />);
container = document.createElement('div');
container.id = 'container';
document.body.appendChild(container);
const wrapper = mount(<MyComponent />, {
attachTo: document.querySelector('#container'),
});
expect(document.activeElement.type).toBeUndefined();
wrapper.instance().focus();
expect(document.activeElement.type).toEqual('text');
Expand Down Expand Up @@ -91,6 +98,13 @@ describe('TextInput', () => {
wrapper.setProps({ placeholder: 'Enter text' });
expect(textInput().props().placeholder).toEqual('Enter text');
});

afterEach(() => {
if (container && container.parentNode) {
container.parentNode.removeChild(container);
}
container = null;
});
});

describe('label', () => {
Expand Down
16 changes: 15 additions & 1 deletion packages/react/src/components/TextInput/TextInput-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ describe('TextInput', () => {
const textInput = () => wrapper.find('input');

describe('input', () => {
let container;

it('renders as expected', () => {
expect(textInput().length).toBe(1);
});
Expand All @@ -47,7 +49,12 @@ describe('TextInput', () => {
);
}
}
const wrapper = mount(<MyComponent />);
container = document.createElement('div');
container.id = 'container';
document.body.appendChild(container);
const wrapper = mount(<MyComponent />, {
attachTo: document.querySelector('#container'),
});
expect(document.activeElement.type).toBeUndefined();
wrapper.instance().focus();
expect(document.activeElement.type).toEqual('text');
Expand Down Expand Up @@ -91,6 +98,13 @@ describe('TextInput', () => {
wrapper.setProps({ placeholder: 'Enter text' });
expect(textInput().props().placeholder).toEqual('Enter text');
});

afterEach(() => {
if (container && container.parentNode) {
container.parentNode.removeChild(container);
}
container = null;
});
});

describe('label', () => {
Expand Down
Loading

0 comments on commit 8efe541

Please sign in to comment.