mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-28 19:52:53 +00:00
[sinon-chrome] Support plugins
This commit is contained in:
parent
9bb6dc2f8b
commit
6596fb459b
20
types/sinon-chrome/index.d.ts
vendored
20
types/sinon-chrome/index.d.ts
vendored
@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/vitalets/sinon-chrome
|
||||
// Definitions by: Tim Perry <https://github.com/pimterry>
|
||||
// CRIMX <https://github.com/crimx>
|
||||
// kobanyan <https://github.com/kobanyan>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@ -37,6 +38,8 @@ declare namespace SinonChrome {
|
||||
*/
|
||||
export function reset(): void;
|
||||
|
||||
export function registerPlugin(plugin: SinonChrome.plugins.Plugin): void;
|
||||
|
||||
export var csi: Sinon.SinonSpy;
|
||||
export var loadTimes: Sinon.SinonSpy;
|
||||
}
|
||||
@ -353,6 +356,23 @@ declare namespace SinonChrome.permissions {
|
||||
export var request: SinonChromeStub;
|
||||
}
|
||||
|
||||
declare namespace SinonChrome.plugins {
|
||||
export interface Plugin {}
|
||||
export interface Translation {
|
||||
message: string;
|
||||
placeholders?: object;
|
||||
}
|
||||
export interface Translations {
|
||||
[key: string]: Translation;
|
||||
}
|
||||
export class I18nPlugin implements Plugin {
|
||||
constructor(translations: Translations);
|
||||
}
|
||||
export class CookiePlugin implements Plugin {
|
||||
constructor(state?: Array<chrome.cookies.Cookie>);
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace SinonChrome.power {
|
||||
export var releaseKeepAwake: SinonChromeStub;
|
||||
export var requestKeepAwake: SinonChromeStub;
|
||||
|
||||
@ -32,3 +32,50 @@ var id: string = chromeStub.runtime.id;
|
||||
|
||||
chromeStub.proxy.settings.set({value: { }, scope: 'regular'});
|
||||
chromeStub.proxy.settings.onChange.trigger();
|
||||
|
||||
chromeStub.registerPlugin(new chromeStub.plugins.I18nPlugin({
|
||||
one: {
|
||||
message: 'Hi!'
|
||||
},
|
||||
two: {
|
||||
message: 'Hi $first_name$ $last_name$!',
|
||||
placeholders: {
|
||||
first_name: {
|
||||
content: '$1'
|
||||
},
|
||||
last_name: {
|
||||
content: '$2'
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
chromeStub.registerPlugin(new chromeStub.plugins.CookiePlugin());
|
||||
|
||||
chromeStub.registerPlugin(new chromeStub.plugins.CookiePlugin(
|
||||
[
|
||||
{
|
||||
domain: '.domain.com',
|
||||
expirationDate: 1511612273,
|
||||
hostOnly: false,
|
||||
httpOnly: false,
|
||||
name: 'COOKIE_NAME',
|
||||
path: '/data',
|
||||
secure: false,
|
||||
session: false,
|
||||
storeId: '0',
|
||||
value: 'COOKIE_VALUE'
|
||||
},
|
||||
{
|
||||
domain: 'other-domain.com',
|
||||
hostOnly: false,
|
||||
httpOnly: false,
|
||||
name: 'other-cookie',
|
||||
path: '/',
|
||||
secure: false,
|
||||
session: true,
|
||||
storeId: '0',
|
||||
value: '123'
|
||||
}
|
||||
]
|
||||
));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user