Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
add commands, test specs for post header, and upgrade Cypress to 3.1.…
Browse files Browse the repository at this point in the history
…5 due to Chrome 72 issue (#2389)
  • Loading branch information
saturninoabril committed Feb 20, 2019
1 parent 9f2732d commit 8db7ff7
Show file tree
Hide file tree
Showing 16 changed files with 295 additions and 29 deletions.
5 changes: 2 additions & 3 deletions components/common/comment_icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ export default class CommentIcon extends React.PureComponent {
handleCommentClick: PropTypes.func.isRequired,
searchStyle: PropTypes.string,
commentCount: PropTypes.number,
id: PropTypes.string,
postId: PropTypes.string,
extraClass: PropTypes.string,
};

static defaultProps = {
idCount: -1,
searchStyle: '',
commentCount: 0,
id: '',
extraClass: '',
};

Expand All @@ -47,7 +46,7 @@ export default class CommentIcon extends React.PureComponent {
selectorId += this.props.idCount;
}

const id = Utils.createSafeId(this.props.idPrefix + '_' + this.props.id);
const id = Utils.createSafeId(this.props.idPrefix + '_' + this.props.postId);

const tooltip = (
<Tooltip
Expand Down
2 changes: 2 additions & 0 deletions components/dot_menu/__snapshots__/dot_menu.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ exports[`components/dot_menu/DotMenu should match snapshot, canDelete 1`] = `
aria-expanded="false"
className="dropdown-toggle post__dropdown color--link style--none"
data-toggle="dropdown"
id="CENTER_button_post_id_1"
type="button"
/>
</OverlayTrigger>
Expand Down Expand Up @@ -129,6 +130,7 @@ exports[`components/dot_menu/DotMenu should match snapshot, on Center 1`] = `
aria-expanded="false"
className="dropdown-toggle post__dropdown color--link style--none"
data-toggle="dropdown"
id="CENTER_button_post_id_1"
type="button"
/>
</OverlayTrigger>
Expand Down
1 change: 1 addition & 0 deletions components/dot_menu/dot_menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ class DotMenu extends Component {
rootClose={true}
>
<button
id={`${this.props.location}_button_${this.props.post.id}`}
ref='dropdownToggle'
className='dropdown-toggle post__dropdown color--link style--none'
type='button'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports[`components/post_view/PostFlagIcon should match snapshot 1`] = `
>
<button
className="style--none flag-icon__container "
id={null}
id="centerPostFlag_post_id"
onClick={[Function]}
>
<FlagIcon
Expand Down Expand Up @@ -66,7 +66,7 @@ exports[`components/post_view/PostFlagIcon should match snapshot 2`] = `
>
<button
className="style--none flag-icon__container visible"
id={null}
id="centerPostFlag_post_id"
onClick={[Function]}
>
<FlagIconFilled
Expand Down
2 changes: 1 addition & 1 deletion components/post_view/post_flag_icon/post_flag_icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default class PostFlagIcon extends React.PureComponent {
}
>
<button
id={flagIconId}
id={flagIconId || `${this.props.idPrefix}_${this.props.postId}`}
className={'style--none flag-icon__container ' + flagVisible}
onClick={this.handlePress}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ exports[`components/post_view/PostInfo should match snapshot, hover 1`] = `
commentCount={0}
extraClass="pull-right"
handleCommentClick={[MockFunction]}
id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
idCount={-1}
idPrefix="commentIcon"
postId="e584uzbwwpny9kengqayx5ayzw"
searchStyle=""
/>
</div>
Expand Down Expand Up @@ -295,9 +295,9 @@ exports[`components/post_view/PostInfo toggleEmojiPicker, should have called pro
commentCount={0}
extraClass="pull-right"
handleCommentClick={[MockFunction]}
id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
idCount={-1}
idPrefix="commentIcon"
postId="e584uzbwwpny9kengqayx5ayzw"
searchStyle=""
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/post_view/post_info/post_info.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default class PostInfo extends React.PureComponent {
idCount={idCount}
handleCommentClick={this.props.handleCommentClick}
commentCount={this.props.replyCount}
id={post.channel_id + '_' + post.id}
postId={post.id}
extraClass={commentIconExtraClass}
/>
);
Expand Down
12 changes: 11 additions & 1 deletion components/post_view/post_time/post_time.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export default class PostTime extends React.PureComponent {
*/
eventTime: PropTypes.number.isRequired,

location: PropTypes.oneOf(['CENTER', 'RHS_ROOT', 'RHS_COMMENT', 'SEARCH']).isRequired,

/*
* The post id of posting being rendered
*/
Expand All @@ -32,6 +34,7 @@ export default class PostTime extends React.PureComponent {

static defaultProps = {
eventTime: 0,
location: 'CENTER',
};

handleClick = () => {
Expand All @@ -50,9 +53,16 @@ export default class PostTime extends React.PureComponent {
return localDateTime;
}

const {
location,
postId,
teamUrl,
} = this.props;

return (
<Link
to={`${this.props.teamUrl}/pl/${this.props.postId}`}
id={`${location}_time_${postId}`}
to={`${teamUrl}/pl/${postId}`}
className='post__permalink'
onClick={this.handleClick}
>
Expand Down
1 change: 1 addition & 0 deletions components/rhs_header_post/rhs_header_post.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export default class RhsHeaderPost extends React.Component {
</OverlayTrigger>
</button>
<button
id='rhsCloseButton'
type='button'
className='sidebar--right__close'
aria-label='Close'
Expand Down
1 change: 1 addition & 0 deletions components/rhs_thread/rhs_thread.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export default class RhsThread extends React.Component {

return (
<div
id='rhsContainer'
className='sidebar-right__body'
ref='sidebarbody'
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ exports[`components/SearchResultsItem should match snapshot for DM 1`] = `
<Connect(PostTime)
eventTime={1502715365009}
isPermalink={true}
location="SEARCH"
postId="id"
/>
<span
Expand Down Expand Up @@ -136,9 +137,9 @@ exports[`components/SearchResultsItem should match snapshot for DM 1`] = `
commentCount={0}
extraClass=""
handleCommentClick={[Function]}
id=""
idCount={-1}
idPrefix="searchCommentIcon"
postId="id"
searchStyle="search-item__comment"
/>
<a
Expand Down Expand Up @@ -300,6 +301,7 @@ exports[`components/SearchResultsItem should match snapshot for archived channel
<Connect(PostTime)
eventTime={1502715365009}
isPermalink={true}
location="SEARCH"
postId="id"
/>
<Connect(PostFlagIcon)
Expand Down Expand Up @@ -341,9 +343,9 @@ exports[`components/SearchResultsItem should match snapshot for archived channel
commentCount={0}
extraClass=""
handleCommentClick={[Function]}
id=""
idCount={-1}
idPrefix="searchCommentIcon"
postId="id"
searchStyle="search-item__comment"
/>
<a
Expand Down Expand Up @@ -505,6 +507,7 @@ exports[`components/SearchResultsItem should match snapshot for channel 1`] = `
<Connect(PostTime)
eventTime={1502715365009}
isPermalink={true}
location="SEARCH"
postId="id"
/>
<Connect(PostFlagIcon)
Expand Down Expand Up @@ -546,9 +549,9 @@ exports[`components/SearchResultsItem should match snapshot for channel 1`] = `
commentCount={0}
extraClass=""
handleCommentClick={[Function]}
id=""
idCount={-1}
idPrefix="searchCommentIcon"
postId="id"
searchStyle="search-item__comment"
/>
<a
Expand Down Expand Up @@ -728,6 +731,7 @@ exports[`components/SearchResultsItem should match snapshot for deleted message
<Connect(PostTime)
eventTime={1502715365009}
isPermalink={true}
location="SEARCH"
postId="id"
/>
</div>
Expand Down
2 changes: 2 additions & 0 deletions components/search_results_item/search_results_item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export default class SearchResultsItem extends React.PureComponent {
isPermalink={isPermalink}
eventTime={post.create_at}
postId={post.id}
location='SEARCH'
/>
);
};
Expand Down Expand Up @@ -253,6 +254,7 @@ export default class SearchResultsItem extends React.PureComponent {
idPrefix={'searchCommentIcon'}
idCount={this.props.lastPostCount}
handleCommentClick={this.handleFocusRHSClick}
postId={post.id}
searchStyle={'search-item__comment'}
/>
<a
Expand Down
Loading

0 comments on commit 8db7ff7

Please sign in to comment.