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

Commit

Permalink
MM-13321: Fix providers that don't extend Provider. (#2139)
Browse files Browse the repository at this point in the history
* Fix providers that don't extend Provider.

* Fix snapshots
  • Loading branch information
grundleborg authored and cpanato committed Dec 5, 2018
1 parent e917fb1 commit 99a5727
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
21 changes: 18 additions & 3 deletions components/__snapshots__/textbox.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ exports[`components/TextBox should match snapshot with required props 1`] = `
"latestPrefix": "",
"requestStarted": false,
},
EmoticonProvider {},
EmoticonProvider {
"disableDispatches": false,
"latestComplete": true,
"latestPrefix": "",
"requestStarted": false,
},
]
}
renderDividers={true}
Expand Down Expand Up @@ -207,7 +212,12 @@ exports[`components/TextBox should throw error when new property is too long 1`]
"latestPrefix": "",
"requestStarted": false,
},
EmoticonProvider {},
EmoticonProvider {
"disableDispatches": false,
"latestComplete": true,
"latestPrefix": "",
"requestStarted": false,
},
]
}
renderDividers={true}
Expand Down Expand Up @@ -357,7 +367,12 @@ exports[`components/TextBox should throw error when value is too long 1`] = `
"latestPrefix": "",
"requestStarted": false,
},
EmoticonProvider {},
EmoticonProvider {
"disableDispatches": false,
"latestComplete": true,
"latestPrefix": "",
"requestStarted": false,
},
]
}
renderDividers={true}
Expand Down
3 changes: 2 additions & 1 deletion components/suggestion/command_provider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import store from 'stores/redux_store.jsx';
import * as UserAgent from 'utils/user_agent.jsx';

import Suggestion from './suggestion.jsx';
import Provider from './provider.jsx';

export class CommandSuggestion extends Suggestion {
render() {
Expand Down Expand Up @@ -38,7 +39,7 @@ export class CommandSuggestion extends Suggestion {
}
}

export default class CommandProvider {
export default class CommandProvider extends Provider {
handlePretextChanged(pretext, resultCallback) {
if (pretext.startsWith('/')) {
const command = pretext.toLowerCase();
Expand Down
3 changes: 2 additions & 1 deletion components/suggestion/emoticon_provider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import store from 'stores/redux_store.jsx';
import * as Emoticons from 'utils/emoticons.jsx';

import Suggestion from './suggestion.jsx';
import Provider from './provider.jsx';

const MIN_EMOTICON_LENGTH = 2;
const EMOJI_CATEGORY_SUGGESTION_BLACKLIST = ['skintone'];
Expand Down Expand Up @@ -49,7 +50,7 @@ class EmoticonSuggestion extends Suggestion {
}
}

export default class EmoticonProvider {
export default class EmoticonProvider extends Provider {
handlePretextChanged(pretext, resultsCallback) {
// Look for the potential emoticons at the start of the text, after whitespace, and at the start of emoji reaction commands
const captured = (/(^|\s|^\+|^-)(:([^:\s]*))$/g).exec(pretext);
Expand Down

0 comments on commit 99a5727

Please sign in to comment.