Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
Pass another unit test that previously was failed
Browse files Browse the repository at this point in the history
  • Loading branch information
silviubogan committed Nov 13, 2020
1 parent 7dd38f8 commit f395aa5
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
16 changes: 9 additions & 7 deletions src/blocks/Table/Cell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,15 @@ class Cell extends Component {
// The tabIndex is required for the keyboard navigation
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
<div onFocus={this.handleContainerFocus.bind(this)} tabIndex={0}>
<SlateEditor
onChange={this.onChange.bind(this)}
value={this.props.value}
selected={this.state.selected}
onFocus={this.handleFocus.bind(this)}
onBlur={this.handleBlur.bind(this)}
/>
{__CLIENT__ && (
<SlateEditor
onChange={this.onChange.bind(this)}
value={this.props.value}
selected={this.state.selected}
onFocus={this.handleFocus.bind(this)}
onBlur={this.handleBlur.bind(this)}
/>
)}
</div>
);
}
Expand Down
29 changes: 29 additions & 0 deletions src/blocks/Table/Cell.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,35 @@ import { Provider } from 'react-intl-redux';
const mockStore = configureStore();

global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
global.__CLIENT__ = false; // eslint-disable-line no-underscore-dangle

jest.mock('~/config', () => {
const createEmptyParagraph = () => {
return {
type: 'p',
children: [{ text: '' }],
};
};
return {
settings: {
supportedLanguages: [],
slate: {
elements: {
default: ({ attributes, children }) => (
<p {...attributes}>{children}</p>
),
},
leafs: {},
defaultBlockType: 'p',
textblockExtensions: [],
extensions: [],
defaultValue: () => {
return [createEmptyParagraph()];
},
},
},
};
});

test('renders a cell component', () => {
const store = mockStore({
Expand Down
1 change: 0 additions & 1 deletion src/blocks/Table/View.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
/**
* Slate Table block's View component.
* @module volto-slate/blocks/Table/View
Expand Down
7 changes: 6 additions & 1 deletion src/blocks/Table/__snapshots__/Cell.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders a cell component 1`] = `<div />`;
exports[`renders a cell component 1`] = `
<div
onFocus={[Function]}
tabIndex={0}
/>
`;

0 comments on commit f395aa5

Please sign in to comment.