Skip to content

Commit c131eaa

Browse files
committed
fix spec to use mount, not shallow
1 parent 6e52167 commit c131eaa

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

test/icon-spec.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import assert from 'power-assert';
22
import React from 'react';
3-
import { shallow } from 'enzyme';
3+
import { mount } from 'enzyme';
44

55
import { Icon } from '../src/scripts/Icon';
66

77
describe('Icon', () => {
88
it('should render icon', () => {
99
const icon = 'check';
10-
const wrapper = shallow(<Icon icon={icon} />);
11-
assert(wrapper.hasClass('slds-icon'));
10+
const wrapper = mount(<Icon icon={icon} />);
11+
assert(wrapper.exists('.slds-icon'));
1212
assert(
1313
wrapper
1414
.html()
@@ -18,14 +18,14 @@ describe('Icon', () => {
1818

1919
it('should render icon with size', () => {
2020
const size = 'small';
21-
const wrapper = shallow(<Icon icon='icon' size={size} />);
22-
assert(wrapper.hasClass(`slds-icon_${size}`));
21+
const wrapper = mount(<Icon icon='icon' size={size} />);
22+
assert(wrapper.exists(`.slds-icon_${size}`));
2323
});
2424

2525
it('should render icon with category', () => {
2626
const category = 'standard';
2727
const icon = 'account';
28-
const wrapper = shallow(<Icon category={category} icon={icon} />);
28+
const wrapper = mount(<Icon category={category} icon={icon} />);
2929
assert(
3030
wrapper
3131
.html()
@@ -37,7 +37,7 @@ describe('Icon', () => {
3737
const category = 'action';
3838
const icon = 'add_contact';
3939
const categoryIcon = `${category}:${icon}`;
40-
const wrapper = shallow(<Icon icon={categoryIcon} />);
40+
const wrapper = mount(<Icon icon={categoryIcon} />);
4141
assert(
4242
wrapper
4343
.html()

test/picklist-spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
2-
import { shallow, mount } from 'enzyme';
2+
import { mount } from 'enzyme';
33

44
import { Picklist, PicklistItem } from '../src/scripts/Picklist';
55

66
describe('Picklist', () => {
77
it('should render picklist with className', () => {
8-
const wrapper = shallow(<Picklist />);
8+
const wrapper = mount(<Picklist />);
99
expect(wrapper.find('.slds-picklist').length).toEqual(1);
1010
});
1111

0 commit comments

Comments
 (0)