mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-09 20:58:12 +08:00
lint(*): correct eslint errors, warnings still exist
There are warnings in `spellcheck-composer-extension.es6` for the `while (true)` loops.
This commit is contained in:
parent
af6f544cc9
commit
f13fc46611
2 changed files with 16 additions and 11 deletions
|
@ -182,11 +182,12 @@ export default class SpellcheckComposerExtension extends ComposerExtension {
|
||||||
static finalizeSessionBeforeSending = ({session}) => {
|
static finalizeSessionBeforeSending = ({session}) => {
|
||||||
const body = session.draft().body;
|
const body = session.draft().body;
|
||||||
const clean = body.replace(/<\/?spelling[^>]*>/g, '');
|
const clean = body.replace(/<\/?spelling[^>]*>/g, '');
|
||||||
|
|
||||||
if (body !== clean) {
|
if (body !== clean) {
|
||||||
return session.changes.add({body: clean});
|
return session.changes.add({body: clean});
|
||||||
} else {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
import AutoloadImagesExtension from '../lib/autoload-images-extension';
|
import AutoloadImagesExtension from '../lib/autoload-images-extension';
|
||||||
import AutoloadImagesStore from '../lib/autoload-images-store';
|
import AutoloadImagesStore from '../lib/autoload-images-store';
|
||||||
|
|
||||||
|
@ -10,6 +11,7 @@ describe("AutoloadImagesExtension", ()=> {
|
||||||
fs.readdirSync(fixtures).forEach((filename) => {
|
fs.readdirSync(fixtures).forEach((filename) => {
|
||||||
if (filename.endsWith('-in.html')) {
|
if (filename.endsWith('-in.html')) {
|
||||||
const name = filename.replace('-in.html', '');
|
const name = filename.replace('-in.html', '');
|
||||||
|
|
||||||
scenarios.push({
|
scenarios.push({
|
||||||
name: name,
|
name: name,
|
||||||
in: fs.readFileSync(path.join(fixtures, filename)).toString(),
|
in: fs.readFileSync(path.join(fixtures, filename)).toString(),
|
||||||
|
@ -21,11 +23,13 @@ describe("AutoloadImagesExtension", ()=> {
|
||||||
scenarios.forEach((scenario)=> {
|
scenarios.forEach((scenario)=> {
|
||||||
it(`should process ${scenario.name}`, () => {
|
it(`should process ${scenario.name}`, () => {
|
||||||
spyOn(AutoloadImagesStore, 'shouldBlockImagesIn').andReturn(true);
|
spyOn(AutoloadImagesStore, 'shouldBlockImagesIn').andReturn(true);
|
||||||
message = {
|
|
||||||
body: scenario.in
|
const message = {
|
||||||
|
body: scenario.in,
|
||||||
};
|
};
|
||||||
AutoloadImagesExtension.formatMessageBody({message});
|
AutoloadImagesExtension.formatMessageBody({message});
|
||||||
expect(message.body == scenario.out).toBe(true);
|
|
||||||
|
expect(message.body === scenario.out).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue