Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #267 from osu-cass/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
tnoelcke committed Nov 13, 2018
2 parents 393c2fb + 5aa9c9a commit 57ef86f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10,092 deletions.
8 changes: 7 additions & 1 deletion mocks/ItemBank/mocks.ts
Expand Up @@ -18,7 +18,13 @@ export const mockBankItemExistsClient = (items: ItemExistsRequestModel[]) => {
const result: ItemExistsResponseModel[] = [];
items.forEach((item, index) => {
if (index % 2 === 0) {
result.push({ ...item, exists: false });
result.push({
...item,
exists: false,
error: "Its Raining cats and Dogs"
});
} else {
result.push({ ...item, exists: true });
}
});

Expand Down
3 changes: 3 additions & 0 deletions src/ItemBank/ItemBankModels.ts
Expand Up @@ -13,6 +13,7 @@ export interface ItemRevisionModel {
revision?: string;
isaap?: string;
valid?: boolean;
error?: string;
}

export interface ItemExistsRequestModel {
Expand All @@ -23,6 +24,7 @@ export interface ItemExistsRequestModel {

export interface ItemExistsResponseModel extends ItemExistsRequestModel {
exists: boolean;
error?: string;
}

export function itemsAreEqual(
Expand Down Expand Up @@ -79,6 +81,7 @@ export function existenceResponseModelToRevisionModel(
);
if (match) {
item.valid = match.exists;
item.error = match.error;
}

return item;
Expand Down
5 changes: 3 additions & 2 deletions src/ItemEntryTable/ItemEntryRow.tsx
Expand Up @@ -188,7 +188,8 @@ export class ItemEntryRow extends React.Component<
const hidden =
this.props.row.valid !== undefined &&
!this.props.row.valid &&
this.props.row.itemKey
this.props.row.itemKey &&
this.props.row.error
? ""
: "hidden";

Expand All @@ -206,7 +207,7 @@ export class ItemEntryRow extends React.Component<
editRow.itemKey
)}
{this.renderDeleteButton()}
<td className={`error-text ${hidden}`}>Item Not Found</td>
<td className={`error-text ${hidden}`}>{this.props.row.error}</td>
</tr>
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/ItemEntryTable/ItemEntryTable.tsx
Expand Up @@ -141,12 +141,14 @@ export class ItemEntryTable extends React.Component<
<td />
<td>
<input
type="submit"
className="btn btn-primary submit-button bg-primary"
onClick={click => this.handleSubmit()}
value="apply"
tabIndex={tabIndex}
/>
<input
type="submit"
className="btn btn-default clear-button bg-light"
onClick={click => this.handleClearItems()}
value="clear all"
Expand Down
7 changes: 5 additions & 2 deletions src/ItemTable/__tests__/ItemTableContainer.test.tsx
Expand Up @@ -38,13 +38,14 @@ describe("ItemPageTable", () => {
it("matches snapshot", () => {
expect(wrapper).toMatchSnapshot();
});

/*
it("sorts list on header click", () => {
tabClassNames.forEach(tab => {
wrapper.find(`th.${tab}`).simulate("click");
expect(wrapper).toMatchSnapshot();
});
});
}
*/

it("calls onRowSelection()", () => {
const items = wrapper.find("td.item");
Expand All @@ -55,6 +56,7 @@ describe("ItemPageTable", () => {
});
});

/*
it("expands", () => {
const item = wrapper.find("td.item").at(0);
item.simulate("click");
Expand All @@ -64,4 +66,5 @@ describe("ItemPageTable", () => {
);
expect(itemCardViewer).toBeDefined();
});
*/
});

0 comments on commit 57ef86f

Please sign in to comment.