Skip to content

Commit

Permalink
changelog and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewMusgrave committed Mar 6, 2019
1 parent 6128e4b commit 6ebc94c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 9 deletions.
1 change: 1 addition & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f

### Bug fixes

- Revert a change that constrained `DropZone` height based on inherited wrapper height [#1129](https://github.com/Shopify/polaris-react/pull/1129)
- Fixed missing rounded corners on `Tag` button states ([#1078](https://github.com/Shopify/polaris-react/pull/1078))
- Removed reference to `window.Polaris`, which in some cases could be undefined ([#1104](https://github.com/Shopify/polaris-react/issues/1104))
- Added padding and margin to `subdued` sections for proper spacing between the header and footer ([#1082](https://github.com/Shopify/polaris-react/pull/1082))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,61 @@ import {Link, Icon, Button, Caption, TextStyle} from 'components';
import {mountWithAppProvider} from 'test-utilities';
import {Provider} from '../../Context';
import FileUpload from '../FileUpload';
import {fileUpload as fileUploadImage, imageUpload} from '../../../images';

describe('<FileUpload />', () => {
it('renders large view', () => {
const fileUpload = mountWithAppProvider(
<Provider value={{size: 'large', type: 'file'}}>
<FileUpload />
</Provider>,
);
describe('extraLarge', () => {
it('renders extra large view for type file', () => {
const fileUpload = mountWithAppProvider(
<Provider value={{size: 'extraLarge', type: 'file'}}>
<FileUpload />
</Provider>,
);

expect(fileUpload.find('img').prop('src')).toBe(fileUploadImage);
expect(fileUpload.find(Button)).toHaveLength(1);
expect(fileUpload.find(TextStyle)).toHaveLength(1);
});

it('renders extra large view for type image', () => {
const fileUpload = mountWithAppProvider(
<Provider value={{size: 'extraLarge', type: 'file'}}>
<FileUpload />
</Provider>,
);

expect(fileUpload.find('img').prop('src')).toBe(imageUpload);
expect(fileUpload.find(Button)).toHaveLength(1);
expect(fileUpload.find(TextStyle)).toHaveLength(1);
});
});

describe('large', () => {
it('renders large view for type file', () => {
const fileUpload = mountWithAppProvider(
<Provider value={{size: 'large', type: 'file'}}>
<FileUpload />
</Provider>,
);

expect(fileUpload.find('img').prop('src')).toBe(fileUploadImage);
expect(fileUpload.find(Button)).toHaveLength(1);
expect(fileUpload.find(TextStyle)).toHaveLength(1);
expect(fileUpload.find(Caption)).toHaveLength(1);
});

it('renders large view for type image', () => {
const fileUpload = mountWithAppProvider(
<Provider value={{size: 'large', type: 'file'}}>
<FileUpload />
</Provider>,
);

expect(fileUpload.find('img')).toHaveLength(1);
expect(fileUpload.find(Button)).toHaveLength(1);
expect(fileUpload.find(TextStyle)).toHaveLength(1);
expect(fileUpload.find('img').prop('src')).toBe(imageUpload);
expect(fileUpload.find(Button)).toHaveLength(1);
expect(fileUpload.find(TextStyle)).toHaveLength(1);
expect(fileUpload.find(Caption)).toHaveLength(1);
});
});

it('renders medium view', () => {
Expand Down

0 comments on commit 6ebc94c

Please sign in to comment.