Fix failed CircleCI

jh-changes
Shin'ya Ueoka 6 years ago
parent 3f4bc62ed5
commit ced89134e3
  1. 4
      e2e/follow_properties.test.js
  2. 6
      src/background/presenters/IndicatorPresenter.ts
  3. 4
      src/background/usecases/CompletionsUseCase.ts
  4. 13
      src/background/usecases/LinkUseCase.ts

@ -126,10 +126,12 @@ describe('follow properties test', () => {
}); });
await body.sendKeys('jj'); await body.sendKeys('jj');
await eventually(async() => {
let tabs = await browser.tabs.query({}); let tabs = await browser.tabs.query({});
assert.equal(tabs[0].active, false); assert.equal(tabs[0].active, false);
assert.equal(tabs[1].active, true); assert.equal(tabs[1].active, true);
}); });
});
it('should open tab in background by background:true', async () => { it('should open tab in background by background:true', async () => {
await body.sendKeys(Key.Control, 'f'); await body.sendKeys(Key.Control, 'f');
@ -139,8 +141,10 @@ describe('follow properties test', () => {
}); });
await body.sendKeys('jj'); await body.sendKeys('jj');
await eventually(async() => {
let tabs = await browser.tabs.query({}); let tabs = await browser.tabs.query({});
assert.equal(tabs[0].active, true); assert.equal(tabs[0].active, true);
assert.equal(tabs[1].active, false); assert.equal(tabs[1].active, false);
}); });
});
}); });

@ -3,13 +3,13 @@ export default class IndicatorPresenter {
let path = enabled let path = enabled
? 'resources/enabled_32x32.png' ? 'resources/enabled_32x32.png'
: 'resources/disabled_32x32.png'; : 'resources/disabled_32x32.png';
if (typeof browser.browserAction.setIcon === "function") { if (typeof browser.browserAction.setIcon === 'function') {
return browser.browserAction.setIcon({ path }); return browser.browserAction.setIcon({ path });
} }
else {
// setIcon not supported on Android // setIcon not supported on Android
return Promise.resolve(); return Promise.resolve();
}
} }
onClick(listener: (arg: browser.tabs.Tab) => void): void { onClick(listener: (arg: browser.tabs.Tab) => void): void {

@ -53,14 +53,14 @@ export default class CompletionsUseCase {
groups.push({ name: 'Search Engines', items: engines }); groups.push({ name: 'Search Engines', items: engines });
} }
// browser.history not supported on Android // browser.history not supported on Android
} else if (c === 'h' && typeof browser.history === "object") { } else if (c === 'h' && typeof browser.history === 'object') {
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
let histories = await this.queryHistoryItems(name, keywords); let histories = await this.queryHistoryItems(name, keywords);
if (histories.length > 0) { if (histories.length > 0) {
groups.push({ name: 'History', items: histories }); groups.push({ name: 'History', items: histories });
} }
// browser.bookmarks not supported on Android // browser.bookmarks not supported on Android
} else if (c === 'b' && typeof browser.bookmarks === "object") { } else if (c === 'b' && typeof browser.bookmarks === 'object') {
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
let bookmarks = await this.queryBookmarkItems(name, keywords); let bookmarks = await this.queryBookmarkItems(name, keywords);
if (bookmarks.length > 0) { if (bookmarks.length > 0) {

@ -11,10 +11,17 @@ export default class LinkUseCase {
return this.tabPresenter.open(url, tabId); return this.tabPresenter.open(url, tabId);
} }
openNewTab(url: string, openerId: number, background: boolean): Promise<any> { async openNewTab(
url: string, openerId: number, background: boolean,
): Promise<any> {
let properties: any = { active: !background };
let platform = await browser.runtime.getPlatformInfo();
if (platform.os !== 'android') {
// openerTabId not supported on Android // openerTabId not supported on Android
let properties = typeof browser.tabs.Tab === "object" ? properties.openerTabId = openerId;
{ openerTabId: openerId, active: !background } : { active: !background }; }
return this.tabPresenter.create(url, properties); return this.tabPresenter.create(url, properties);
} }
} }