Skip to content

Commit 375b2d3

Browse files
committed
Fix .isEmpty() deprecation warnings
1 parent 1486c43 commit 375b2d3

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

tests/unit/components/Asset.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('Asset', () => {
5555
it('renders a div.asset', () => {
5656
const wrapper = mountAsset('foo.bar');
5757
expect(wrapper.element.matches('div.asset')).toBe(true);
58-
expect(wrapper.isEmpty()).toBe(true);
58+
expect(wrapper.element.childElementCount === 0).toBe(true);
5959
});
6060

6161
it('renders an `ImageAsset` for images', () => {

tests/unit/components/ContentNode.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('ContentNode', () => {
6363

6464
const content = wrapper.findComponent('div.content');
6565
expect(content.exists()).toBe(true);
66-
expect(content.isEmpty()).toBe(true);
66+
expect(content.element.childElementCount === 0).toBe(true);
6767
});
6868

6969
describe('with type="aside"', () => {
@@ -111,7 +111,7 @@ describe('ContentNode', () => {
111111
expect(codeListing.props('syntax')).toBe(listing.syntax);
112112
expect(codeListing.props('fileType')).toBe(listing.fileType);
113113
expect(codeListing.props('content')).toEqual(listing.code);
114-
expect(codeListing.isEmpty()).toBe(true);
114+
expect(codeListing.element.childElementCount === 0).toBe(true);
115115
});
116116

117117
it('renders a `Figure`/`Caption` with metadata', () => {
@@ -187,7 +187,7 @@ describe('ContentNode', () => {
187187
expect(sectionTitle.exists()).toBe(true);
188188
expect(sectionTitle.props('level')).toBe(level);
189189
expect(sectionTitle.attributes('anchor')).toBe('heading');
190-
expect(sectionTitle.isEmpty()).toBe(false);
190+
expect(sectionTitle.text().length > 0).toBe(true);
191191
expect(sectionTitle.text()).toContain('heading');
192192
}
193193
});
@@ -1029,7 +1029,7 @@ describe('ContentNode', () => {
10291029
expect(reference.props('ideTitle')).toBe('IDETitle');
10301030
expect(reference.props('titleStyle')).toBe('symbol');
10311031
expect(reference.props('hasInlineFormatting')).toBe(false);
1032-
expect(reference.isEmpty()).toBe(false);
1032+
expect(reference.text().length > 0).toBe(true);
10331033
expect(reference.text()).toBe('FooBar');
10341034
});
10351035

@@ -1295,7 +1295,7 @@ describe('ContentNode', () => {
12951295
});
12961296

12971297
const reference = wrapper.findComponent('.content');
1298-
expect(reference.isEmpty()).toBe(true);
1298+
expect(reference.element.childElementCount === 0).toBe(true);
12991299
});
13001300
});
13011301

tests/unit/components/Tutorial/Assessments.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ describe('success slot for completed assessment', () => {
281281
const ariaLive = wrapper.findComponent('[aria-live="assertive"].visuallyhidden');
282282
expect(ariaLive.exists()).toBe(true);
283283
// assert that aria-live's slot is empty
284-
expect(ariaLive.isEmpty()).toBe(true);
284+
expect(ariaLive.element.childElementCount === 0).toBe(true);
285285

286286
await wrapper.setData({ completed: true });
287287
// assert that aria-live's slot has been updated

tests/unit/components/WordBreak.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('WordBreak', () => {
2121
it('renders an empty span', () => {
2222
const wrapper = shallowMount(WordBreak);
2323
expect(wrapper.element.tagName.toLowerCase() === 'span').toBe(true);
24-
expect(wrapper.isEmpty()).toBe(true);
24+
expect(wrapper.element.childElementCount === 0).toBe(true);
2525
});
2626
});
2727

tests/unit/views/DocumentationTopic.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ describe('DocumentationTopic', () => {
161161

162162
const codeTheme = wrapper.findComponent(CodeTheme);
163163
expect(codeTheme.exists()).toBe(true);
164-
expect(codeTheme.isEmpty()).toEqual(true);
164+
expect(codeTheme.element.childElementCount === 0).toEqual(true);
165165
});
166166

167167
it('sets enableNavigator to true if schemaVersion is compatible', async () => {

tests/unit/views/Topic.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('Topic', () => {
4848

4949
it('renders an empty div with no data', () => {
5050
expect(wrapper.element.tagName.toLowerCase() === 'div').toBe(true);
51-
expect(wrapper.isEmpty()).toBe(true);
51+
expect(wrapper.element.childElementCount === 0).toBe(true);
5252
});
5353

5454
it('provides a positive offset for `navigationBarHeight`', () => {

0 commit comments

Comments
 (0)