Skip to content

Commit fb9f42a

Browse files
committed
update tests and props
1 parent 8c349bd commit fb9f42a

File tree

8 files changed

+20
-1
lines changed

8 files changed

+20
-1
lines changed

packages/compass-crud/src/components/document-json-view.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export type DocumentJsonViewProps = {
3333
| 'removeDocument'
3434
| 'replaceDocument'
3535
| 'updateDocument'
36+
| 'openErrorDetailsDialog'
3637
| 'openInsertDocumentDialog'
3738
>;
3839

packages/compass-crud/src/components/document-list-view.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ describe('<DocumentListView />', function () {
2121
replaceDocument={sinon.spy()}
2222
updateDocument={sinon.spy()}
2323
openInsertDocumentDialog={sinon.spy()}
24+
openErrorDetailsDialog={sinon.spy()}
2425
/>
2526
);
2627

packages/compass-crud/src/components/document-list-view.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export type DocumentListViewProps = {
3535
| 'replaceDocument'
3636
| 'updateDocument'
3737
| 'openInsertDocumentDialog'
38+
| 'openErrorDetailsDialog'
3839
>;
3940

4041
/**
@@ -66,6 +67,7 @@ class DocumentListView extends React.Component<DocumentListViewProps> {
6667
replaceDocument={this.props.replaceDocument}
6768
updateDocument={this.props.updateDocument}
6869
openInsertDocumentDialog={this.props.openInsertDocumentDialog}
70+
openErrorDetailsDialog={this.props.openErrorDetailsDialog}
6971
/>
7072
</KeylineCard>
7173
</li>
@@ -97,6 +99,7 @@ class DocumentListView extends React.Component<DocumentListViewProps> {
9799
replaceDocument: PropTypes.func,
98100
updateDocument: PropTypes.func,
99101
openInsertDocumentDialog: PropTypes.func,
102+
openErrorDetailsDialog: PropTypes.func,
100103
copyToClipboard: PropTypes.func,
101104
className: PropTypes.string,
102105
};

packages/compass-crud/src/components/document.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Document.propTypes = {
5757
replaceDocument: PropTypes.func,
5858
updateDocument: PropTypes.func,
5959
openInsertDocumentDialog: PropTypes.func,
60+
openErrorDetailsDialog: PropTypes.func,
6061
copyToClipboard: PropTypes.func,
6162
isExpanded: PropTypes.bool,
6263
};

packages/compass-crud/src/components/editable-document.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ describe('<EditableDocument />', function () {
2222
updateDocument={sinon.spy(action)}
2323
copyToClipboard={sinon.spy(action)}
2424
openInsertDocumentDialog={sinon.spy(action)}
25+
openErrorDetailsDialog={sinon.spy(action)}
2526
/>
2627
);
2728
});

packages/compass-crud/src/components/editable-document.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export type EditableDocumentProps = {
1919
replaceDocument?: CrudActions['replaceDocument'];
2020
updateDocument?: CrudActions['updateDocument'];
2121
openInsertDocumentDialog?: CrudActions['openInsertDocumentDialog'];
22+
openErrorDetailsDialog?: CrudActions['openErrorDetailsDialog'];
2223
copyToClipboard?: CrudActions['copyToClipboard'];
2324
showInsights?: boolean;
2425
};
@@ -278,6 +279,12 @@ class EditableDocument extends React.Component<
278279
onCancel={() => {
279280
this.handleCancel();
280281
}}
282+
// onOpenErrorDetails{() => {
283+
// this.props.openErrorDetailsDialog?.({
284+
// details: '// TODO erro details',
285+
// closeAction: 'close',
286+
// })
287+
// }}
281288
/>
282289
);
283290
}

packages/compass-crud/src/components/json-editor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export type JSONEditorProps = {
5858
updateDocument?: CrudActions['updateDocument'];
5959
copyToClipboard?: CrudActions['copyToClipboard'];
6060
openInsertDocumentDialog?: CrudActions['openInsertDocumentDialog'];
61+
openErrorDetailsDialog?: CrudActions['openErrorDetailsDialog'];
6162
};
6263

6364
const JSONEditor: React.FunctionComponent<JSONEditorProps> = ({

packages/compass-crud/src/stores/crud-store.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ describe('store', function () {
290290
docsPerPage: 25,
291291
end: 0,
292292
error: null,
293+
errorDetailsOpen: null,
293294
insert: {
294295
doc: null,
295296
isCommentNeeded: true,
@@ -1447,7 +1448,10 @@ describe('store', function () {
14471448
expect(state.insert.jsonDoc).to.deep.equal(docs);
14481449
expect(state.insert.isOpen).to.equal(true);
14491450
expect(state.insert.jsonView).to.equal(true);
1450-
expect(state.insert.message).to.equal('Document failed validation');
1451+
expect(state.insert.error).to.not.be.null;
1452+
expect(state.insert.error?.message).to.equal(
1453+
'Document failed validation'
1454+
);
14511455
});
14521456

14531457
store.state.insert.jsonDoc = docs;

0 commit comments

Comments
 (0)