-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
2,088 additions
and
314 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
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
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
40 changes: 40 additions & 0 deletions
40
apps/comments-ui/src/components/content/context-menus/CommentContextMenu.test.jsx
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,40 @@ | ||
import CommentContextMenu from './CommentContextMenu'; | ||
import React from 'react'; | ||
import sinon from 'sinon'; | ||
import {AppContext} from '../../../AppContext'; | ||
import {buildComment} from '../../../../test/utils/fixtures'; | ||
import {render, screen} from '@testing-library/react'; | ||
|
||
const contextualRender = (ui, {appContext, ...renderOptions}) => { | ||
const contextWithDefaults = { | ||
member: null, | ||
dispatchAction: () => {}, | ||
t: str => str, | ||
...appContext | ||
}; | ||
|
||
return render( | ||
<AppContext.Provider value={contextWithDefaults}>{ui}</AppContext.Provider>, | ||
renderOptions | ||
); | ||
}; | ||
|
||
describe('<CommentContextMenu>', () => { | ||
afterEach(() => { | ||
sinon.restore(); | ||
}); | ||
|
||
it('has display-below classes when in viewport', () => { | ||
const comment = buildComment(); | ||
contextualRender(<CommentContextMenu comment={comment} />, {appContext: {admin: true, labs: {commentImprovements: true}}}); | ||
expect(screen.getByTestId('comment-context-menu-inner')).toHaveClass('top-0'); | ||
}); | ||
|
||
it('has display-above classes when bottom is out of viewport', () => { | ||
sinon.stub(HTMLElement.prototype, 'getBoundingClientRect').returns({bottom: 2000}); | ||
|
||
const comment = buildComment(); | ||
contextualRender(<CommentContextMenu comment={comment} />, {appContext: {admin: true, labs: {commentImprovements: true}}}); | ||
expect(screen.getByTestId('comment-context-menu-inner')).toHaveClass('bottom-full', 'mb-6'); | ||
}); | ||
}); |
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
2 changes: 1 addition & 1 deletion
2
apps/comments-ui/src/components/content/context-menus/NotAuthorContextMenu.tsx
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.