-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove unused line * Create modalContext * Update modalContext and add CustomModal component * Update modalContext w/ setComponent * Initial display of CustomModal component * Refactor NewsWidget and RemoveSectionModal * Updates to refactor CustomCollection and RemoveCustomCollectionModal * Temporarily add handleRemoveCollection back * Updates to add AddCustomLinkModal functionality to CustomModal * Move functionality of EditCustomLinkModal to CustomModal * Clean up * Clean up * Clean up * Update renderWithModalRoot * Update props for storybook components * Update * Update w/ defaultMockModalContext * Fix NewsWidget tests * Update tests * Update tests * Remove comments * Update tests * Add initial tests for modalContext * Update test * Update test * Fix add bookmark bug and add test in modalContext * Update tests w/ added mocks * Update test to save updated bookmark * Update tests * Update to click Delete button in modal * Update test and add test for deleting custom bookmark * Ignore functions that should not be factored into test coverage * Add check to close dropdown on modal close * Update conditional render * Update test * Update type * Remove useRef * Remove/add comments * Add comment * Update test * Update tests
- Loading branch information
Showing
25 changed files
with
1,253 additions
and
731 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ObjectId } from 'mongodb' | ||
import { AddBookmarkDocument } from 'operations/portal/mutations/addBookmark.g' | ||
|
||
const mockBookmark = { | ||
url: 'example.com', | ||
label: 'My Custom Label', | ||
cmsId: null, | ||
isRemoved: null, | ||
} | ||
|
||
export const mockCollectionId = ObjectId() | ||
|
||
export const addBookmarkMock = [ | ||
{ | ||
request: { | ||
query: AddBookmarkDocument, | ||
variables: { | ||
collectionId: mockCollectionId, | ||
url: mockBookmark.url, | ||
label: mockBookmark.label, | ||
}, | ||
}, | ||
result: { | ||
data: { | ||
_id: ObjectId(), | ||
url: mockBookmark.url, | ||
label: mockBookmark.label, | ||
}, | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { ObjectId } from 'mongodb' | ||
import { EditBookmarkDocument } from 'operations/portal/mutations/editBookmark.g' | ||
import { Bookmark } from 'types' | ||
|
||
export const mockBookmark: Bookmark = { | ||
_id: ObjectId(), | ||
url: 'example.com', | ||
label: 'Custom Label', | ||
} | ||
|
||
export const mockCollectionIdForEditBookmark = ObjectId() | ||
|
||
export const editBookmarkMock = [ | ||
{ | ||
request: { | ||
query: EditBookmarkDocument, | ||
variables: { | ||
_id: mockBookmark._id, | ||
collectionId: mockCollectionIdForEditBookmark, | ||
url: mockBookmark.url, | ||
label: mockBookmark.label, | ||
}, | ||
}, | ||
result: { | ||
data: { | ||
_id: mockBookmark._id, | ||
label: 'Updated Label', | ||
url: mockBookmark.url, | ||
}, | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ObjectId } from 'mongodb' | ||
import { RemoveBookmarkDocument } from 'operations/portal/mutations/removeBookmark.g' | ||
|
||
export const mockRemoveBookmark = { | ||
_id: ObjectId(), | ||
url: 'example.com', | ||
label: 'Remove me', | ||
} | ||
|
||
export const mockRemoveBookmarkCollectionId = ObjectId() | ||
|
||
export const removeBookmarkMock = [ | ||
{ | ||
request: { | ||
query: RemoveBookmarkDocument, | ||
variables: { | ||
_id: mockRemoveBookmark._id, | ||
collectionId: mockRemoveBookmarkCollectionId, | ||
}, | ||
}, | ||
result: { | ||
data: { | ||
_id: mockRemoveBookmark._id, | ||
}, | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ObjectId } from 'mongodb' | ||
import { RemoveCollectionDocument } from 'operations/portal/mutations/removeCollection.g' | ||
import { Collection } from 'types' | ||
|
||
export const mockCollection: Collection = { | ||
_id: ObjectId(), | ||
title: 'Test Collection', | ||
type: 'Collection', | ||
bookmarks: [], | ||
} | ||
|
||
export const removeCollectionMock = [ | ||
{ | ||
request: { | ||
query: RemoveCollectionDocument, | ||
variables: { | ||
_id: mockCollection._id, | ||
}, | ||
}, | ||
result: { | ||
data: { | ||
_id: mockCollection._id, | ||
}, | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ObjectId } from 'mongodb' | ||
import { RemoveWidgetDocument } from 'operations/portal/mutations/removeWidget.g' | ||
|
||
export const mockWidget = { | ||
_id: ObjectId(), | ||
} | ||
|
||
export const removeWidgetMock = [ | ||
{ | ||
request: { | ||
query: RemoveWidgetDocument, | ||
variables: { | ||
_id: mockWidget._id, | ||
}, | ||
}, | ||
result: { | ||
data: { | ||
_id: mockWidget._id, | ||
}, | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.