Skip to content

Commit

Permalink
fix test warnings (#1691)
Browse files Browse the repository at this point in the history
  • Loading branch information
aciccarello authored Mar 19, 2021
1 parent a5d4f4a commit 4784284
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/avatar/tests/unit/Avatar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('Avatar', () => {
.setProperty('@root', 'role', 'image')
.setProperty('@root', 'aria-label', 'test')
.setProperty('@root', 'styles', { backgroundImage: 'url(img.jpg)' })
.setChildren('@root', [])
.setChildren('@root', () => [])
);
});

Expand Down
8 changes: 5 additions & 3 deletions src/button/tests/unit/Button.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ registerSuite('Button', {

'renders labels'() {
const h = harness(() => <Button>{{ label: 'Text' }}</Button>, [compareId]);
h.expect(template.replaceChildren('button', [<span classes={css.label}>Text</span>]));
h.expect(
template.replaceChildren('button', () => [<span classes={css.label}>Text</span>])
);
},

'renders icons before labels'() {
Expand All @@ -144,7 +146,7 @@ registerSuite('Button', {
[compareId]
);
h.expect(
template.replaceChildren('button', [
template.replaceChildren('button', () => [
<span classes={css.icon}>
<Icon type="starIcon" size="small" />
</span>,
Expand All @@ -166,7 +168,7 @@ registerSuite('Button', {
[compareId]
);
h.expect(
template.replaceChildren('button', [
template.replaceChildren('button', () => [
<span classes={css.label}>Text</span>,
<span classes={css.icon}>
<Icon type="starIcon" size="small" />
Expand Down
2 changes: 1 addition & 1 deletion src/calendar/tests/unit/Calendar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ registerSuite('Calendar', {
h.trigger('@date-4', 'onKeyDown', Keys.Left, () => {});
h.expect(
baseTemplate
.setChildren('tbody', mayDates(-1, 31))
.setChildren('tbody', () => mayDates(-1, 31))
.setProperty('@date-picker', 'month', 4)
.setProperty('@date-31', 'focusable', true)
);
Expand Down
2 changes: 1 addition & 1 deletion src/helper-text/tests/unit/HelperText.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const baseTemplate = assertationTemplate(() => {
return <div key="root" classes={[undefined, css.root, null, null]} />;
});

const textTemplate = baseTemplate.setChildren('@root', [
const textTemplate = baseTemplate.setChildren('@root', () => [
<p key="text" classes={css.text} aria-hidden="true" title="test">
test
</p>
Expand Down
7 changes: 4 additions & 3 deletions src/number-input/tests/unit/NumberInput.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ registerSuite('NumberInput', {
type: 'number',
theme: { '@dojo/widgets/text-input': textInputCss }
})
.setChildren(':root', [
{ label: 'label', leading: <div />, trailing: <div /> }
] as any)
.setChildren(
':root',
() => [{ label: 'label', leading: <div />, trailing: <div /> }] as any
)
);
},
'passes correct value to underlying TextInput'() {
Expand Down
10 changes: 5 additions & 5 deletions src/pagination/tests/Pagination.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ describe('Pagination', () => {
);

h.expect(
visibleAssertion.replaceChildren('@links', [
visibleAssertion.replaceChildren('@links', () => [
prev,
...makeLinks(5, 9),
<div key="current" classes={css.currentPage}>
Expand All @@ -268,7 +268,7 @@ describe('Pagination', () => {
});

describe('page size selector', () => {
const sizeSelectorAssertion = visibleAssertion.append(':root', [
const sizeSelectorAssertion = visibleAssertion.append(':root', () => [
<div classes={css.selectWrapper}>
<Select
key="page-size-select"
Expand Down Expand Up @@ -357,7 +357,7 @@ describe('Pagination', () => {
}
);
h.expect(
visibleAssertion.setChildren('@links', [
visibleAssertion.setChildren('@links', () => [
prev,
...makeLinks(7, 9),
<div key="current" classes={css.currentPage}>
Expand All @@ -384,7 +384,7 @@ describe('Pagination', () => {
.setProperty('@links', 'styles', {
opacity: '1'
})
.setChildren('@links', [
.setChildren('@links', () => [
prev,
...makeLinks(8, 9),
<div key="current" classes={css.currentPage}>
Expand All @@ -408,7 +408,7 @@ describe('Pagination', () => {
});

h.expect(
visibleAssertion.setChildren('@links', [
visibleAssertion.setChildren('@links', () => [
prev,
...makeLinks(1),
<div key="current" classes={css.currentPage}>
Expand Down
2 changes: 1 addition & 1 deletion src/popup/tests/Popup.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ describe('Popup', () => {
opacity: '1',
top: '300px'
})
.setChildren('@wrapper', [<div>hello world</div>])
.setChildren('@wrapper', () => [<div>hello world</div>])
);
// despite widget given position="above", the effective position is "below"
// due to space restrictions
Expand Down
4 changes: 2 additions & 2 deletions src/slide-pane/tests/unit/SlidePane.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const closedTemplateRight = closedTemplate.setProperty('@content', 'classes', [
]);

const openTemplate = closedTemplate
.insertBefore('@content', [
.insertBefore('@content', () => [
v('div', {
classes: [null, fixedCss.underlay],
enterAnimation: animations.fadeIn,
Expand Down Expand Up @@ -137,7 +137,7 @@ registerSuite('SlidePane', {
'Render correct children'() {
const h = harness(() => <SlidePane key="foo" underlay={false} />);

h.expect(closedTemplate.setChildren('~textContent', []));
h.expect(closedTemplate.setChildren('~textContent', () => []));
},

'change property to close'() {
Expand Down
12 changes: 6 additions & 6 deletions src/slider/tests/unit/Slider.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ registerSuite('Slider', {
.setProperty('~fill', 'styles', { width: '20%' })
.setProperty('~thumb', 'styles', { left: '20%' })
.setProperty('~output', 'styles', { top: '80%' })
.setChildren('~output', ['6'])
.setChildren('~output', () => ['6'])
);
}
},
Expand All @@ -233,7 +233,7 @@ registerSuite('Slider', {
.setProperty('@input', 'max', '40')
.setProperty('~fill', 'styles', { width: '100%' })
.setProperty('~thumb', 'styles', { left: '100%' })
.setChildren('~output', ['40'])
.setChildren('~output', () => ['40'])
);
},

Expand All @@ -246,7 +246,7 @@ registerSuite('Slider', {
.setProperty('@input', 'min', '30')
.setProperty('~fill', 'styles', { width: '0%' })
.setProperty('~thumb', 'styles', { left: '0%' })
.setChildren('~output', ['30'])
.setChildren('~output', () => ['30'])
);
},

Expand All @@ -260,7 +260,7 @@ registerSuite('Slider', {
.setProperty('@input', 'max', '40')
.setProperty('~fill', 'styles', { width: '100%' })
.setProperty('~thumb', 'styles', { left: '100%' })
.setChildren('~output', ['40'])
.setChildren('~output', () => ['40'])
);
},
'min value should be respected'() {
Expand All @@ -272,7 +272,7 @@ registerSuite('Slider', {
.setProperty('@input', 'min', '30')
.setProperty('~fill', 'styles', { width: '0%' })
.setProperty('~thumb', 'styles', { left: '0%' })
.setChildren('~output', ['30'])
.setChildren('~output', () => ['30'])
);
},
'max value should be respected'() {
Expand All @@ -283,7 +283,7 @@ registerSuite('Slider', {
.setProperty('@input', 'max', '40')
.setProperty('~fill', 'styles', { width: '100%' })
.setProperty('~thumb', 'styles', { left: '100%' })
.setChildren('~output', ['40'])
.setChildren('~output', () => ['40'])
);
},
events() {
Expand Down
8 changes: 4 additions & 4 deletions src/snackbar/tests/unit/Snackbar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('Snackbar', () => {
}}
</Snackbar>
));
const nonStringTemplate = template.setChildren('@label', [<div>test</div>]);
const nonStringTemplate = template.setChildren('@label', () => [<div>test</div>]);
h.expect(nonStringTemplate);
});

Expand All @@ -61,7 +61,7 @@ describe('Snackbar', () => {
}}
</Snackbar>
));
const multipleNonStringTemplate = template.setChildren('@label', [
const multipleNonStringTemplate = template.setChildren('@label', () => [
<div>test</div>,
<div>test2</div>
]);
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('Snackbar', () => {
}}
</Snackbar>
));
const actionsTemplate = template.insertAfter('~label', [
const actionsTemplate = template.insertAfter('~label', () => [
<div key="actions" classes={css.actions}>
<Button>Dismiss</Button>
</div>
Expand All @@ -194,7 +194,7 @@ describe('Snackbar', () => {
}}
</Snackbar>
));
const actionsTemplate = template.insertAfter('~label', [
const actionsTemplate = template.insertAfter('~label', () => [
<div key="actions" classes={css.actions}>
<Button>Retry</Button>
<Button>Close</Button>
Expand Down

2 comments on commit 4784284

@vercel
Copy link

@vercel vercel bot commented on 4784284 Mar 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

widget-test-docs – ./

widget-test-docs-git-master-dojo1.vercel.app
widget-test-docs.now.sh
widget-test-docs-dojo1.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 4784284 Mar 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dojo.widgets – ./

dojowidgets-dojo1.vercel.app
dojowidgets-git-master-dojo1.vercel.app
next.widgets.dojo.io

Please sign in to comment.