Fix tests (wip)

This commit is contained in:
Aviral Dasgupta 2016-09-13 16:46:20 +05:30
parent b62622a814
commit fbf2d5f96c
3 changed files with 8 additions and 9 deletions

View file

@ -18,7 +18,6 @@ export default class AutocompleteProvider {
let commandRegex = this.commandRegex;
if (force && this.shouldForceComplete()) {
console.log('forcing complete');
commandRegex = /[^\W]+/g;
}

View file

@ -11,11 +11,11 @@ import {getCompletions} from '../../../autocomplete/Autocompleter';
const COMPOSER_SELECTED = 0;
export default class Autocomplete extends React.Component {
completionPromise: Promise = null;
constructor(props) {
super(props);
this.completionPromise = null;
this.onConfirm = this.onConfirm.bind(this);
this.state = {

View file

@ -394,12 +394,12 @@ export default class MessageComposerInput extends React.Component {
onEditorContentChanged(editorState: EditorState, didRespondToUserInput: boolean = true) {
editorState = RichText.attachImmutableEntitiesToEmoji(editorState);
const setPromise = Q.defer();
const contentChanged = Q.defer();
/* If a modification was made, set originalEditorState to null, since newState is now our original */
this.setState({
editorState,
originalEditorState: didRespondToUserInput ? null : this.state.originalEditorState,
}, () => setPromise.resolve());
}, () => contentChanged.resolve());
if (editorState.getCurrentContent().hasText()) {
this.onTypingActivity();
@ -414,11 +414,11 @@ export default class MessageComposerInput extends React.Component {
this.props.onContentChanged(textContent, selection);
}
return setPromise;
return contentChanged.promise;
}
setEditorState(editorState: EditorState) {
this.onEditorContentChanged(editorState, false);
return this.onEditorContentChanged(editorState, false);
}
enableRichtext(enabled: boolean) {
@ -434,13 +434,13 @@ export default class MessageComposerInput extends React.Component {
contentState = ContentState.createFromText(markdown);
}
this.setEditorState(this.createEditorState(enabled, contentState), () => {
this.setEditorState(this.createEditorState(enabled, contentState)).then(() => {
this.setState({
isRichtextEnabled: enabled,
});
});
UserSettingsStore.setSyncedSetting('MessageComposerInput.isRichTextEnabled', enabled);
UserSettingsStore.setSyncedSetting('MessageComposerInput.isRichTextEnabled', enabled);
});
}
handleKeyCommand(command: string): boolean {