Skip to content

Commit 7f9defa

Browse files
bfoxx1906jlandisBoxtjiang-boxtjuanitas
authored
feat(timestamped-comments): enable timestamp handling in sidebar (#4275)
* feat(timestamped-comments): feature enabled timesetamp support * feat(timestamped-comments): updating stories and adding toggle form * feat(timestamped-comments): fixing flow errors * feat(timestamped-comments): removing unnecessary prop * feat(timestamped-comments): removing formatting * feat(timestamped-comments): removing async modifier * feat(timestamped-comments): removing unnecssary import * feat(timestamped-comments): passing down file prop to BaseComment * feat(metadata-instance-editor): remove ai agent selector split and fi… (#4226) * feat(metadata-instance-editor): remove ai agent selector split and fix styling * fix: tests * fix: tests * feat: use new box ai agent selector with alignment * feat(metadata-view): Implement metadata sidepanel (#4230) * feat(metadata-view): Implement metadata sidepanel * feat(metadata-view): resolve comments * feat(metadata-view): resolve comments * feat(metadata-view): resolve nits * feat(timestamped-comments): addressing PR feedback * feat(timestamped-comments): addressing PR comments * feat(timestamped-comments): addressing PR feedback * feat(video-annotations): initial commit * feat(timestamped-commments): reverting annotations related changes * feat(timestamped-commments): reverting unnecessary properties * feat(timestamped-comments): adding storybook support updating UI * feat(timestamped-comments): fixing test failures * feat(timestamped-comments): fixing styling * feat(timestamped-comments): adding unit tests * feat(timestamped-comments): removing text * feat(timestamped-comments): styling, behavior, test updates * feat(timestamped-comments): removing unnecessary prop * feat(timestamped-comments): adding ariaMultiline attribute back * feat(timestamped-comments): removing unnecessary prop * feat(timestamped-comments): code cleanup * feat(timestamped-comments): feature enabled timesetamp support * feat(timestamped-comments): updating stories and adding toggle form * feat(timestamped-comments): fixing flow errors * feat(timestamped-comments): updating from PR comments * feat(timestamped-comments): removing unnecessary code * feat(timestamped-comments): reverting tagged mesage formatting * feat(timestamped-comments): fixes * feat(timestamped-comments): removing space * feat(timestamped-comments): restoring yarn.lock file * feat(timestamped-comments): adding space * feat(timestamped-comments): fixing space issue from merge * feat(timestamped-comments): fixing merge issue * feat(timestamped-comments): adding comments, css changes * feat(timestamped-comments): fixing flow issues * feat(timestamped-comments): addressing pr comments adding internationalization * feat(timestamped-comments): removing unnecssary message * feat(timestamped-comments): code updates feat(timestamped-comments): updating code logic feat(timestamped-comments): refactoring, preventing multiple ts from being prependded feat(timestamped-comments): initial commit feat(timestamped-comments): addressing pr comments feat(timestamped-comments): renaming scss file feat(timestamped-comments): fixing name feat(timstamped-comments): addressing PR comments feat(timestamped-comments): code updates for activity sidebar timestamped comments feat(timestamped-comments): fixing unit tests feat(timestamped-comments): fixing unit tests feat(timestamped-comments): updating timesamp component and unit tests feat(timestamped-comments): adding scss file feat(timestamped-comments): adding version support feat(timestamped-comments): updates for modifying comments with timestamps feat(timestamped-comments): udpate to handle toggle state when editing feat(timestamped-comments): fixing flow errors fix(classification): use AsyncLoad for AppliedByAiClassificationReason (#4274) * fix(classification): use AsyncLoad for AppliedByAiClassificationReason * fix(classification): test nits --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> feat(timestamped-comments): removing console log statement Revert "feat(timestamped-comments): renaming scss file" This reverts commit 24b962e. * feat(timestampd-comments): reverting changes * feat(timestampd-comments): reverting changes * feat(timestamped-comments): revrting changes * feat(timestamped-comments): addresing nits from previous commit * feat(timestamped-comments): moving files, updating timestamp format * feat(timestamped-comments): changing class names * feat(timestamped-comments): fixing flow issues * feat(timestamped-comments): fixing flow error * feat(timestampd-comment): reworking message timestamp button * feat(timestamped-comments): adding aria label to button * feat(timestamped-comments): fixing broken test * feat(timestamped-comments): removing null check * feat(timestamped-comments): fixing tests * feat(timestamped-comments): fixing flow issues * feat(timestamped-comments): addressing PR comment * feat(timestamped-comments): addressing pr feedback * feat(timestamped-comments): addressing PR comments * feat(timestamped-comments): fixing token import and flow issues * feat(timestamped-comments): using blueprint tokens for colors * feat(timestamped-comments): addressing PR comments * feat(timestamped-comments): scss style change * feat(timestamped-comments): addressing PR comments * feat(timestamped-comments): adding comments as pre PR comment * feat(timestamped-comments): fixed flow error * feat(timestamped-comments): addressing PR comments * feat(timestamped-comment): adding data-target-id for observability * Update src/components/form-elements/draft-js-mention-selector/DraftJSMentionSelector.js Co-authored-by: Trevor <[email protected]> * Update src/components/form-elements/draft-js-mention-selector/__tests__/DraftJSMentionSelector.test.js Co-authored-by: Trevor <[email protected]> * Update src/utils/__tests__/timestamp.test.js Co-authored-by: Trevor <[email protected]> * feat(timestamped-comments): addressing PR comments * feat(timestamped-comments): replacing create fragment call with jsx * feat(timestamped-comments): addressing pr feedback * feat(timestamped-comments): removing test classname --------- Co-authored-by: jlandisBox <[email protected]> Co-authored-by: Jerry Jiang <[email protected]> Co-authored-by: Trevor <[email protected]>
1 parent 540a957 commit 7f9defa

24 files changed

+697
-144
lines changed

i18n/en-US.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ be.contentSidebar.activityFeed.common.editedMessage = \ (edited)
232232
be.contentSidebar.activityFeed.common.seeLessMessage = See less
233233
# See more button for showing whole long message
234234
be.contentSidebar.activityFeed.common.seeMoreMessage = See more
235+
# Accessibility label for timestamp button that allows jumping to a specific time in media
236+
be.contentSidebar.activityFeed.common.timestampLabel = Seek to video timestamp
235237
# Translate button for translating comment
236238
be.contentSidebar.activityFeed.common.translateMessage = Translate
237239
# Text for aria label of approval task circle type icon

src/components/form-elements/draft-js-mention-selector/DraftJSMentionSelector.js

Lines changed: 66 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import * as messages from '../input-messages';
1111
import type { SelectorItems } from '../../../common/types/core';
1212
import Toggle from '../../toggle/Toggle';
1313
import { UNEDITABLE_TIMESTAMP_TEXT } from './utils';
14+
import { convertSecondsToHMMSS } from '../../../utils/timestamp';
15+
16+
type videoTimestamp = {
17+
timestamp: string,
18+
timestampInMilliseconds: number,
19+
};
1420

1521
/**
1622
* Scans a Draft ContentBlock for entity ranges, so they can be annotated
@@ -35,7 +41,9 @@ const mentionStrategy = (contentBlock, callback, contentState) => {
3541
* @param {ContentState} contentState
3642
*/
3743
const timestampStrategy = (contentBlock: any, callback: (start: number, end: number) => void, contentState: any) => {
38-
if (!contentBlock || !contentState) return;
44+
if (!contentBlock || !contentState) {
45+
return;
46+
}
3947
contentBlock.findEntityRanges(character => {
4048
const entityKey = character.getEntity();
4149
const hasEntityKey = entityKey !== null;
@@ -52,6 +60,7 @@ type Props = {
5260
contactsLoaded?: boolean,
5361
description?: React.Node,
5462
editorState?: EditorState,
63+
fileVersionId?: string,
5564
hideLabel?: boolean,
5665
isDisabled?: boolean,
5766
isRequired?: boolean,
@@ -120,6 +129,26 @@ class DraftJSMentionSelector extends React.Component<Props, State> {
120129
return contacts ? { contacts } : null;
121130
}
122131

132+
componentDidMount() {
133+
// if video timestamping is enabled we need to check if a timestamp entity is present in the editor state passed in via props
134+
// and if it is then set the isTimestampToggledOn state to true. This will happen when the user is editing a comment
135+
// that has a timestamp entity.
136+
if (this.getIsVideoTimestampEnabled()) {
137+
const { isTimestampToggledOn, internalEditorState } = this.state;
138+
const { editorState: externalEditorState } = this.props;
139+
const currentEditorState = internalEditorState || externalEditorState;
140+
// if video timestamping is enabled and the editor state is being passed in check if a timestamp entity is present
141+
// and if it is then set the isTimestampToggledOn state to true.
142+
if (!isTimestampToggledOn && currentEditorState) {
143+
const currentContent = currentEditorState.getCurrentContent();
144+
const isTimeStampEntityPresent = this.getIsTimestampEntityPresent(currentContent);
145+
if (isTimeStampEntityPresent) {
146+
this.setState({ isTimestampToggledOn: true });
147+
}
148+
}
149+
}
150+
}
151+
123152
componentDidUpdate(prevProps: Props, prevState: State) {
124153
const { internalEditorState: prevInternalEditorState } = prevState;
125154
const { internalEditorState } = this.state;
@@ -145,7 +174,7 @@ class DraftJSMentionSelector extends React.Component<Props, State> {
145174
}
146175

147176
// if isRequired is false then the comment box will be closed and we want
148-
// to make sure that isTimestampToggledOn is alawys set to false in this casee
177+
// to make sure that isTimestampToggledOn is always set to false in this casee
149178
if (this.getIsVideoTimestampEnabled() && isRequired !== prevIsRequiredFromProps && isRequired === false) {
150179
this.setState({ isTimestampToggledOn: false });
151180
}
@@ -197,30 +226,36 @@ class DraftJSMentionSelector extends React.Component<Props, State> {
197226
return;
198227
}
199228

200-
const timestampLengthIncludingSpace = this.getTimestampLength(currentContent, currentContent.getFirstBlock());
229+
const timestampLengthIncludingSpace = this.getTimestampLength(currentContent);
201230
const isTimestampEntityPresent = timestampLengthIncludingSpace > 0;
202231

203232
// check if we need to toggle the timestamp on and that the timestamp entity is not already present in the content
204233
if ((!isTimestampToggledOn || forceOn) && !isTimestampEntityPresent) {
205234
// get the current timestamp
206-
const timestamp = this.getVideoTimestamp();
235+
const { timestamp, timestampInMilliseconds } = this.getVideoTimestamp();
236+
const { fileVersionId } = this.props;
207237
const timestampText = `${timestamp}`;
208-
// Create a new entity for the timestamp. It is immutable so it will not be editable.
238+
// Create a new entity for the timestamp. It is immutable so it will not be editable. Adding
239+
// timestampInMilliseconds, and fileVersionId to the entity data which will be used when the comment form is submitted
240+
// and will be added to the text of the comment. This will let us filter out timetsamped comments based on version and also
241+
// be able to click the timestamp button in comments in the sidebar and got to the proper place in the video.
209242
// $FlowFixMe
210-
const timestampEntity = currentContent?.createEntity(
243+
const contentWithTimestampEntity = currentContent.createEntity(
211244
UNEDITABLE_TIMESTAMP_TEXT, // Entity type
212245
'IMMUTABLE',
213-
{ timestamp },
246+
{ timestampInMilliseconds, fileVersionId },
214247
);
215248

216249
// Create a selection at the very beginning of the input box for the timestamp
217-
const selectionAtStart = SelectionState.createEmpty(currentContent.getFirstBlock().getKey()).merge({
250+
const selectionAtStart = SelectionState.createEmpty(
251+
contentWithTimestampEntity.getFirstBlock().getKey(),
252+
).merge({
218253
anchorOffset: 0,
219254
focusOffset: 0,
220255
});
221256

222257
// First insert the timestamp text followed by a space
223-
updatedContent = Modifier.insertText(currentContent, selectionAtStart, `${timestampText} `);
258+
updatedContent = Modifier.insertText(contentWithTimestampEntity, selectionAtStart, `${timestampText} `);
224259

225260
// Then select the timestamp text not including the space
226261
const selectionWithTimestamp = SelectionState.createEmpty(updatedContent.getFirstBlock().getKey()).merge({
@@ -229,7 +264,7 @@ class DraftJSMentionSelector extends React.Component<Props, State> {
229264
});
230265

231266
// Get the entity key for the timestamp entity
232-
const entityKey = timestampEntity.getLastCreatedEntityKey();
267+
const entityKey = contentWithTimestampEntity.getLastCreatedEntityKey();
233268

234269
// Apply the timestamp entity to selected timestamp text. This will ensure that the timestamp is uneditable and that
235270
// the decorator will apply the proper styling to the timestamp.
@@ -238,7 +273,7 @@ class DraftJSMentionSelector extends React.Component<Props, State> {
238273
newIsTimestampToggledOn = true;
239274
} else {
240275
// Create a selection range for the timestamp text and space so that we know what to remove and
241-
// remove it from the beginning of the input box. This usess the timestsamp length that we calculated earlier.
276+
// remove it from the beginning of the input box. This uses the timestsamp length that we calculated earlier.
242277
const selectionToRemove = SelectionState.createEmpty(currentContent.getFirstBlock().getKey()).merge({
243278
anchorOffset: 0,
244279
focusOffset: timestampLengthIncludingSpace,
@@ -339,14 +374,20 @@ class DraftJSMentionSelector extends React.Component<Props, State> {
339374
}
340375
};
341376

377+
getIsTimestampEntityPresent = (currentContent: ContentState): boolean => {
378+
return this.getTimestampLength(currentContent) > 0;
379+
};
380+
342381
/**
343382
* Calculates the length of the timestamp entity in the current block
344383
* @param {ContentState} currentContent The current content state
345384
* @param {ContentBlock} block The content block to analyze
346385
* @returns {number} The length of the timestamp entity (including the space after it)
347386
*/
348-
getTimestampLength = (currentContent: ContentState, block: any): number => {
349-
if (!block || !currentContent) {
387+
getTimestampLength = (currentContent: ContentState): number => {
388+
// $FlowFixMe
389+
const block = currentContent?.getFirstBlock();
390+
if (!currentContent || !block) {
350391
return 0;
351392
}
352393
let timestampLength = 0;
@@ -381,7 +422,7 @@ class DraftJSMentionSelector extends React.Component<Props, State> {
381422
if (this.getIsVideoTimestampEnabled() && isTimestampToggledOn) {
382423
const currentContent = nextEditorState.getCurrentContent();
383424
const firstBlock = currentContent.getFirstBlock();
384-
const timestampLength = this.getTimestampLength(currentContent, firstBlock);
425+
const timestampLength = this.getTimestampLength(currentContent);
385426
const timestampEntityFound = timestampLength > 0;
386427
// If timestamp entity is no longer present, update the state
387428
if (!timestampEntityFound) {
@@ -421,19 +462,22 @@ class DraftJSMentionSelector extends React.Component<Props, State> {
421462
this.handleValidityStateUpdateHandler();
422463
};
423464

424-
getVideoTimestamp = () => {
465+
getVideoTimestamp = (): videoTimestamp => {
425466
const mediaDashContainer: ?HTMLElement = document.querySelector('.bp-media-dash');
426467
// $FlowFixMe
427468
const video: ?HTMLVideoElement = mediaDashContainer?.querySelector('video');
428469

429-
// $FlowFixMe
430-
const totalSeconds = Math.floor(video?.currentTime || 0);
470+
const currentTime = video?.currentTime || 0;
431471

432-
const hours = Math.floor(totalSeconds / 3600);
433-
const minutes = Math.floor((totalSeconds % 3600) / 60);
434-
const seconds = totalSeconds % 60;
472+
// We need to get the nubmer of seconds in HMMSS format to display in the timestamp button
473+
// and the timestamp in milliseconds to use when the comment form is submitted. This is because
474+
// milliseconds are more precise than seconds and we need to make sure that we go to the right frame
475+
// when the comment timestamp is clicked in the sidebar.
476+
const totalSeconds = Math.floor(currentTime);
477+
const timestampToDisplay = convertSecondsToHMMSS(totalSeconds);
478+
const timestampInMilliseconds = Math.floor(currentTime * 1000);
435479

436-
return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
480+
return { timestamp: timestampToDisplay, timestampInMilliseconds };
437481
};
438482

439483
render() {
@@ -496,6 +540,7 @@ class DraftJSMentionSelector extends React.Component<Props, State> {
496540
{isRequired && this.getIsVideoTimestampEnabled() && (
497541
<Toggle
498542
className="bcs-CommentTimestamp-toggle"
543+
data-target-id="Toggle-CommentTimestamp"
499544
// $FlowFixMe - timestampLabel is guaranteed to be defined when getIsVideoTimestampEnabled() returns true
500545
label={timestampLabel}
501546
isOn={timestampToggledOn}

src/components/form-elements/draft-js-mention-selector/DraftTimestamp.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import '../../../styles/variables';
22

33
.bcs-CommentTimestamp-entity {
4-
color: $bdl-box-blue-80;
4+
color: var(--box-blue-110, #0057c0);
55
font-size: $bdl-fontSize--dejaBlue;
66
line-height: $bdl-line-height;
77
border-radius: $bdl-border-radius-size;

src/components/form-elements/draft-js-mention-selector/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ The component hierarchy from topmost to bottommost is:
3939

4040
### Restoring Editor State
4141

42-
Use `createMentionSelectorState(tagged_message)` instead of `EditorState.createFromContent()` when restoring content that already contains mentions.
43-
44-
This will parse the tagged message and create `type: MENTION` entities. It returns an EditorState instance.
42+
Use `createMentionTimestampSelectorState(tagged_message)` instead of `EditorState.createFromContent()` when restoring content that already contains mentions or timestamps. This will parse the tagged message and create `type: MENTION` or `type: UNEDITABLE_TIMESTAMP_TEXT` entities. It returns an EditorState instance.
4543

4644
### Examples
4745

src/components/form-elements/draft-js-mention-selector/__tests__/DraftJSMentionSelector.test.js

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describe('bcomponents/form-elements/draft-js-mention-selector/DraftJSMentionSele
6767
expect(instance.state.isTimestampToggledOn).toEqual(true);
6868
expect(wrapper.find('Toggle').length).toEqual(1);
6969
expect(wrapper.find('Toggle').prop('isOn')).toEqual(true);
70-
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).toContain('00:01:10');
70+
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).toContain('0:01:10');
7171
});
7272
});
7373

@@ -470,7 +470,9 @@ describe('bcomponents/form-elements/draft-js-mention-selector/DraftJSMentionSele
470470
});
471471
const wrapper = shallow(<DraftJSMentionSelector {...requiredProps} />);
472472
const instance = wrapper.instance();
473-
expect(instance.getVideoTimestamp()).toEqual('00:01:10');
473+
const { timestamp, timestampInMilliseconds } = instance.getVideoTimestamp();
474+
expect(timestamp).toEqual('0:01:10');
475+
expect(timestampInMilliseconds).toEqual(70000);
474476
});
475477

476478
test('should return the correct videoe timestamp if it has not been started yet', () => {
@@ -483,10 +485,12 @@ describe('bcomponents/form-elements/draft-js-mention-selector/DraftJSMentionSele
483485
};
484486
});
485487
const instance = wrapper.instance();
486-
expect(instance.getVideoTimestamp()).toEqual('00:00:00');
488+
const { timestamp, timestampInMilliseconds } = instance.getVideoTimestamp();
489+
expect(timestamp).toEqual('0:00:00');
490+
expect(timestampInMilliseconds).toEqual(0);
487491
});
488492

489-
test('shoudl return 00:00:00 if the video is not found', () => {
493+
test('should return 0:00:00 if the video is not found', () => {
490494
jest.spyOn(document, 'querySelector').mockImplementation(() => {
491495
return {
492496
querySelector: () => {
@@ -496,7 +500,9 @@ describe('bcomponents/form-elements/draft-js-mention-selector/DraftJSMentionSele
496500
});
497501
const wrapper = shallow(<DraftJSMentionSelector {...requiredProps} />);
498502
const instance = wrapper.instance();
499-
expect(instance.getVideoTimestamp()).toEqual('00:00:00');
503+
const { timestamp, timestampInMilliseconds } = instance.getVideoTimestamp();
504+
expect(timestamp).toEqual('0:00:00');
505+
expect(timestampInMilliseconds).toEqual(0);
500506
});
501507

502508
test('should return the correct precision of the timestamp', () => {
@@ -509,12 +515,19 @@ describe('bcomponents/form-elements/draft-js-mention-selector/DraftJSMentionSele
509515
});
510516
const wrapper = shallow(<DraftJSMentionSelector {...requiredProps} />);
511517
const instance = wrapper.instance();
512-
expect(instance.getVideoTimestamp()).toEqual('00:02:56');
518+
const { timestamp, timestampInMilliseconds } = instance.getVideoTimestamp();
519+
expect(timestamp).toEqual('0:02:56');
520+
expect(timestampInMilliseconds).toEqual(176340);
513521
});
514522
});
515523
describe('video timestamp toggle', () => {
516524
const getTimestampedEnableComponent = () => {
517-
const props = { ...requiredProps, timestampLabel: 'Toggle Timestamp', isRequired: true };
525+
const props = {
526+
...requiredProps,
527+
timestampLabel: 'Toggle Timestamp',
528+
isRequired: true,
529+
fileVersionId: '123',
530+
};
518531
return shallow(<DraftJSMentionSelector {...props} />);
519532
};
520533

@@ -536,17 +549,17 @@ describe('bcomponents/form-elements/draft-js-mention-selector/DraftJSMentionSele
536549
const wrapper = getTimestampedEnableComponent();
537550
const instance = wrapper.instance();
538551
wrapper.find('Toggle').simulate('change', { target: { checked: true } });
539-
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).toContain('00:01:10');
552+
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).toContain('0:01:10');
540553
expect(instance.state.isTimestampToggledOn).toEqual(true);
541554
});
542555

543556
test('should remove timestamp from the editor state when the toggle is clicked off', () => {
544557
const wrapper = getTimestampedEnableComponent();
545558
const instance = wrapper.instance();
546559
wrapper.find('Toggle').simulate('change', { target: { checked: true } });
547-
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).toContain('00:01:10');
560+
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).toContain('0:01:10');
548561
wrapper.find('Toggle').simulate('change', { target: { checked: false } });
549-
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).not.toContain('00:01:10');
562+
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).not.toContain('0:01:10');
550563
expect(instance.state.isTimestampToggledOn).toEqual(false);
551564
});
552565

@@ -558,7 +571,7 @@ describe('bcomponents/form-elements/draft-js-mention-selector/DraftJSMentionSele
558571
});
559572
wrapper.find('Toggle').simulate('change', { target: { checked: true } });
560573
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).toContain(
561-
'00:01:10 this is coool!!!',
574+
'0:01:10 this is coool!!!',
562575
);
563576
});
564577

@@ -569,7 +582,7 @@ describe('bcomponents/form-elements/draft-js-mention-selector/DraftJSMentionSele
569582
internalEditorState: EditorState.createWithContent(ContentState.createFromText('this is coool!!!')),
570583
});
571584
wrapper.find('Toggle').simulate('change', { target: { checked: true } });
572-
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).toContain('00:01:10');
585+
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).toContain('0:01:10');
573586
wrapper.find('Toggle').simulate('change', { target: { checked: false } });
574587
expect(instance.state.internalEditorState.getCurrentContent().getPlainText()).toEqual('this is coool!!!');
575588
});
@@ -584,7 +597,8 @@ describe('bcomponents/form-elements/draft-js-mention-selector/DraftJSMentionSele
584597
const rawContentState = convertToRaw(instance.state.internalEditorState.getCurrentContent());
585598
const entity = rawContentState.entityMap[0];
586599
expect(entity.type).toEqual('UNEDITABLE_TIMESTAMP_TEXT');
587-
expect(entity.data.timestamp).toEqual('00:01:10');
600+
expect(entity.data.timestampInMilliseconds).toEqual(70000);
601+
expect(entity.data.fileVersionId).toEqual('123');
588602
});
589603

590604
test('should remove the UNEDITABLE_TIMESTAMP_TEXT entity from the editor state when the toggle is clicked off', () => {

0 commit comments

Comments
 (0)