|
@@ -212,6 +212,44 @@ ifdescribe(features.isBuiltinSpellCheckerEnabled())('spellchecker', function ()
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ describe('ses.setSpellCheckerLanguages', () => {
|
|
|
+ const isMac = process.platform === 'darwin';
|
|
|
+
|
|
|
+ ifit(isMac)('should be a no-op when setSpellCheckerLanguages is called on macOS', () => {
|
|
|
+ expect(() => {
|
|
|
+ w.webContents.session.setSpellCheckerLanguages(['i-am-a-nonexistent-language']);
|
|
|
+ }).to.not.throw();
|
|
|
+ });
|
|
|
+
|
|
|
+ ifit(!isMac)('should throw when a bad language is passed', () => {
|
|
|
+ expect(() => {
|
|
|
+ w.webContents.session.setSpellCheckerLanguages(['i-am-a-nonexistent-language']);
|
|
|
+ }).to.throw(/Invalid language code provided: "i-am-a-nonexistent-language" is not a valid language code/);
|
|
|
+ });
|
|
|
+
|
|
|
+ ifit(!isMac)('should not throw when a recognized language is passed', () => {
|
|
|
+ expect(() => {
|
|
|
+ w.webContents.session.setSpellCheckerLanguages(['es']);
|
|
|
+ }).to.not.throw();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('SetSpellCheckerDictionaryDownloadURL', () => {
|
|
|
+ const isMac = process.platform === 'darwin';
|
|
|
+
|
|
|
+ ifit(isMac)('should be a no-op when a bad url is passed on macOS', () => {
|
|
|
+ expect(() => {
|
|
|
+ w.webContents.session.setSpellCheckerDictionaryDownloadURL('i-am-not-a-valid-url');
|
|
|
+ }).to.not.throw();
|
|
|
+ });
|
|
|
+
|
|
|
+ ifit(!isMac)('should throw when a bad url is passed', () => {
|
|
|
+ expect(() => {
|
|
|
+ w.webContents.session.setSpellCheckerDictionaryDownloadURL('i-am-not-a-valid-url');
|
|
|
+ }).to.throw(/The URL you provided to setSpellCheckerDictionaryDownloadURL is not a valid URL/);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
describe('ses.removeWordFromSpellCheckerDictionary', () => {
|
|
|
it('should successfully remove words to custom dictionary', async () => {
|
|
|
const result1 = ses.addWordToSpellCheckerDictionary('foobar');
|