Skip to content

Commit

Permalink
More autofixes from sk format
Browse files Browse the repository at this point in the history
  • Loading branch information
BPScott committed Mar 25, 2020
1 parent 104fe19 commit 5a3f982
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 68 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
@@ -1,4 +1,4 @@
module.exports = function(api) {
module.exports = function (api) {
// When building (using rollup) or running storybook (using babel-loader) we
// want to compile for the web otherwise compile for node usage (within jest)
const isWeb = api.caller((caller = {}) => {
Expand Down
18 changes: 6 additions & 12 deletions src/components/ActionMenu/tests/ActionMenu.test.tsx
Expand Up @@ -57,12 +57,9 @@ describe('<ActionMenu />', () => {

const wrapper = mountWithAppProvider(<ActionMenu actions={actions} />);

expect(
wrapper
.find(MenuAction)
.at(overrideIndex)
.prop('content'),
).toBe(actionWithIndex.content);
expect(wrapper.find(MenuAction).at(overrideIndex).prop('content')).toBe(
actionWithIndex.content,
);
});

it('renders all actions in their overridden order when multiple indexes are set', () => {
Expand Down Expand Up @@ -185,12 +182,9 @@ describe('<ActionMenu />', () => {
const groups = [...mockGroups, groupWithIndex];
const wrapper = mountWithAppProvider(<ActionMenu groups={groups} />);

expect(
wrapper
.find(MenuGroup)
.at(overrideIndex)
.prop('title'),
).toBe(groupWithIndex.title);
expect(wrapper.find(MenuGroup).at(overrideIndex).prop('title')).toBe(
groupWithIndex.title,
);
});

it('renders all groups in their overridden order when multiple indexes are set', () => {
Expand Down
18 changes: 6 additions & 12 deletions src/components/Avatar/tests/Avatar.test.tsx
Expand Up @@ -96,24 +96,18 @@ describe('<Avatar />', () => {
const avatar = mountWithAppProvider(
<Avatar accessibilityLabel="Hello World" />,
);
expect(
avatar
.find('span')
.first()
.prop('aria-label'),
).toBe('Hello World');
expect(avatar.find('span').first().prop('aria-label')).toBe(
'Hello World',
);
});
});

describe('name', () => {
it('is passed to the aria-label', () => {
const avatar = mountWithAppProvider(<Avatar name="Hello World" />);
expect(
avatar
.find('span')
.first()
.prop('aria-label'),
).toBe('Hello World');
expect(avatar.find('span').first().prop('aria-label')).toBe(
'Hello World',
);
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/DataTable/utilities.ts
Expand Up @@ -7,7 +7,7 @@ interface TableMeasurements {
}

export function measureColumn(tableData: TableMeasurements) {
return function(column: HTMLElement, index: number) {
return function (column: HTMLElement, index: number) {
const {
firstVisibleColumnIndex,
tableLeftVisibleEdge: tableStart,
Expand Down
16 changes: 4 additions & 12 deletions src/components/DescriptionList/tests/DescriptionList.test.tsx
Expand Up @@ -25,18 +25,10 @@ describe('<DescriptionList />', () => {
<DescriptionList items={items} />,
);

expect(
descriptionList
.find('dt')
.first()
.contains('Term 1'),
).toBe(true);
expect(descriptionList.find('dt').first().contains('Term 1')).toBe(true);

expect(
descriptionList
.find('dd')
.first()
.contains('Description 1'),
).toBe(true);
expect(descriptionList.find('dd').first().contains('Description 1')).toBe(
true,
);
});
});
14 changes: 2 additions & 12 deletions src/components/Filters/tests/Filters.test.tsx
Expand Up @@ -244,19 +244,9 @@ describe('<Filters />', () => {
.first();

trigger(shortcut, 'onClick');
expect(
resourceFilters
.find(Popover)
.first()
.props().active,
).toBe(true);
expect(resourceFilters.find(Popover).first().props().active).toBe(true);
trigger(shortcut, 'onClick');
expect(
resourceFilters
.find(Popover)
.first()
.props().active,
).toBe(false);
expect(resourceFilters.find(Popover).first().props().active).toBe(false);
});

it('receives the expected props when there are no shortcut filters', () => {
Expand Down
Expand Up @@ -126,10 +126,7 @@ describe('<Navigation.Section />', () => {
},
);

channels
.find('a')
.first()
.simulate('click');
channels.find('a').first().simulate('click');
animationFrame.runFrame();

expect(context.onNavigationDismiss).toHaveBeenCalledTimes(1);
Expand All @@ -147,10 +144,7 @@ describe('<Navigation.Section />', () => {
);
findByTestID(channels, 'ToggleViewAll').simulate('click');

channels
.find('a')
.first()
.simulate('click');
channels.find('a').first().simulate('click');

act(() => {
animationFrame.runFrame();
Expand Down Expand Up @@ -193,19 +187,11 @@ describe('<Navigation.Section />', () => {

findByTestID(withSubNav, 'ToggleViewAll').simulate('click');

withSubNav
.find('a[href="/other"]')
.first()
.simulate('click');
withSubNav.find('a[href="/other"]').first().simulate('click');

animationFrame.runFrame();

expect(
withSubNav
.find(Collapsible)
.first()
.prop('open'),
).toBe(true);
expect(withSubNav.find(Collapsible).first().prop('open')).toBe(true);
});

it('adds a toggle button if rollupAfter has a value', () => {
Expand Down

0 comments on commit 5a3f982

Please sign in to comment.