mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-22 13:32:28 -05:00
Rename paint-editor to new folder too
and update click tests to just look at the base component
This commit is contained in:
parent
1abb10d320
commit
b1ca3f29d5
8 changed files with 40 additions and 91 deletions
|
@ -2,26 +2,26 @@ import bindAll from 'lodash.bindall';
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import PaperCanvas from '../containers/paper-canvas.jsx';
|
||||
import PaperCanvas from '../../containers/paper-canvas.jsx';
|
||||
|
||||
import BrushMode from '../containers/brush-mode.jsx';
|
||||
import EraserMode from '../containers/eraser-mode.jsx';
|
||||
import ReshapeMode from '../containers/reshape-mode.jsx';
|
||||
import SelectMode from '../containers/select-mode.jsx';
|
||||
import LineMode from '../containers/line-mode.jsx';
|
||||
import PenMode from '../containers/pen-mode.jsx';
|
||||
import RectMode from '../containers/rect-mode.jsx';
|
||||
import RoundedRectMode from '../containers/rounded-rect-mode.jsx';
|
||||
import OvalMode from '../containers/oval-mode.jsx';
|
||||
import BrushMode from '../../containers/brush-mode.jsx';
|
||||
import EraserMode from '../../containers/eraser-mode.jsx';
|
||||
import ReshapeMode from '../../containers/reshape-mode.jsx';
|
||||
import SelectMode from '../../containers/select-mode.jsx';
|
||||
import LineMode from '../../containers/line-mode.jsx';
|
||||
import PenMode from '../../containers/pen-mode.jsx';
|
||||
import RectMode from '../../containers/rect-mode.jsx';
|
||||
import RoundedRectMode from '../../containers/rounded-rect-mode.jsx';
|
||||
import OvalMode from '../../containers/oval-mode.jsx';
|
||||
|
||||
import FillColorIndicatorComponent from '../containers/fill-color-indicator.jsx';
|
||||
import StrokeColorIndicatorComponent from '../containers/stroke-color-indicator.jsx';
|
||||
import StrokeWidthIndicatorComponent from '../containers/stroke-width-indicator.jsx';
|
||||
import FillColorIndicatorComponent from '../../containers/fill-color-indicator.jsx';
|
||||
import StrokeColorIndicatorComponent from '../../containers/stroke-color-indicator.jsx';
|
||||
import StrokeWidthIndicatorComponent from '../../containers/stroke-width-indicator.jsx';
|
||||
|
||||
import {defineMessages, injectIntl, intlShape} from 'react-intl';
|
||||
import BufferedInputHOC from './forms/buffered-input-hoc.jsx';
|
||||
import Label from './forms/label.jsx';
|
||||
import Input from './forms/input.jsx';
|
||||
import BufferedInputHOC from '../forms/buffered-input-hoc.jsx';
|
||||
import Label from '../forms/label.jsx';
|
||||
import Input from '../forms/input.jsx';
|
||||
|
||||
import styles from './paint-editor.css';
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
/* eslint-env jest */
|
||||
import React from 'react'; // eslint-disable-line no-unused-vars
|
||||
import {shallow} from 'enzyme';
|
||||
import BrushModeComponent from '../../../src/components/brush-mode.jsx'; // eslint-disable-line no-unused-vars
|
||||
|
||||
describe('BrushModeComponent', () => {
|
||||
test('triggers callback when clicked', () => {
|
||||
const onClick = jest.fn();
|
||||
const componentShallowWrapper = shallow(
|
||||
<BrushModeComponent onMouseDown={onClick}/>
|
||||
);
|
||||
componentShallowWrapper.simulate('click');
|
||||
expect(onClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
/* eslint-env jest */
|
||||
import React from 'react'; // eslint-disable-line no-unused-vars
|
||||
import {shallow} from 'enzyme';
|
||||
import EraserModeComponent from '../../../src/components/eraser-mode.jsx'; // eslint-disable-line no-unused-vars
|
||||
|
||||
describe('EraserModeComponent', () => {
|
||||
test('triggers callback when clicked', () => {
|
||||
const onClick = jest.fn();
|
||||
const componentShallowWrapper = shallow(
|
||||
<EraserModeComponent onMouseDown={onClick}/>
|
||||
);
|
||||
componentShallowWrapper.simulate('click');
|
||||
expect(onClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
/* eslint-env jest */
|
||||
import React from 'react'; // eslint-disable-line no-unused-vars
|
||||
import {shallow} from 'enzyme';
|
||||
import LineModeComponent from '../../../src/components/line-mode.jsx'; // eslint-disable-line no-unused-vars
|
||||
|
||||
describe('LineModeComponent', () => {
|
||||
test('triggers callback when clicked', () => {
|
||||
const onClick = jest.fn();
|
||||
const componentShallowWrapper = shallow(
|
||||
<LineModeComponent onMouseDown={onClick}/>
|
||||
);
|
||||
componentShallowWrapper.simulate('click');
|
||||
expect(onClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
/* eslint-env jest */
|
||||
import React from 'react'; // eslint-disable-line no-unused-vars
|
||||
import {shallow} from 'enzyme';
|
||||
import ReshapeModeComponent from '../../../src/components/reshape-mode.jsx'; // eslint-disable-line no-unused-vars
|
||||
|
||||
describe('ReshapeModeComponent', () => {
|
||||
test('triggers callback when clicked', () => {
|
||||
const onClick = jest.fn();
|
||||
const componentShallowWrapper = shallow(
|
||||
<ReshapeModeComponent onMouseDown={onClick}/>
|
||||
);
|
||||
componentShallowWrapper.simulate('click');
|
||||
expect(onClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
/* eslint-env jest */
|
||||
import React from 'react'; // eslint-disable-line no-unused-vars
|
||||
import {shallow} from 'enzyme';
|
||||
import SelectModeComponent from '../../../src/components/select-mode.jsx'; // eslint-disable-line no-unused-vars
|
||||
|
||||
describe('SelectModeComponent', () => {
|
||||
test('triggers callback when clicked', () => {
|
||||
const onClick = jest.fn();
|
||||
const componentShallowWrapper = shallow(
|
||||
<SelectModeComponent onMouseDown={onClick}/>
|
||||
);
|
||||
componentShallowWrapper.simulate('click');
|
||||
expect(onClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
24
test/unit/components/tool-select-click.test.jsx
Normal file
24
test/unit/components/tool-select-click.test.jsx
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* eslint-env jest */
|
||||
import React from 'react'; // eslint-disable-line no-unused-vars
|
||||
import {shallow} from 'enzyme';
|
||||
import ToolSelectComponent from '../../../src/components/tool-select-base/tool-select-base.jsx'; // eslint-disable-line no-unused-vars, max-len
|
||||
|
||||
describe('ToolSelectComponent', () => {
|
||||
test('triggers callback when clicked', () => {
|
||||
const onClick = jest.fn();
|
||||
const componentShallowWrapper = shallow(
|
||||
<ToolSelectComponent
|
||||
imgDescriptor={{
|
||||
defaultMessage: 'Select',
|
||||
description: 'Label for the select tool, which allows selecting, moving, and resizing shapes',
|
||||
id: 'paint.selectMode.select'
|
||||
}}
|
||||
imgSrc={''}
|
||||
isSelected={false}
|
||||
onMouseDown={onClick}
|
||||
/>
|
||||
);
|
||||
componentShallowWrapper.simulate('click');
|
||||
expect(onClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue