mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-01-30 13:37:35 +00:00
[video.js] change plugin test so that it does not include the test plugin in the types (#39915)
* all plugins are optional, so plugins option should be a Partial<> * fix whitespace * fix plugin test so that the test plugin isn't packaged w/ types
This commit is contained in:
parent
92e12e8810
commit
bb58538ffb
33
types/video.js/test/plugin-tests.ts
Normal file
33
types/video.js/test/plugin-tests.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import videojs from 'video.js';
|
||||
|
||||
declare module 'video.js' {
|
||||
interface VideoJsPlayer {
|
||||
somePlugin(options?: SomePluginOptions): SomePluginType;
|
||||
}
|
||||
|
||||
interface VideoJsPlayerPluginOptions {
|
||||
somePlugin: SomePluginOptions;
|
||||
}
|
||||
|
||||
interface SomePluginOptions {
|
||||
test: boolean;
|
||||
}
|
||||
|
||||
class SomePluginType {}
|
||||
}
|
||||
|
||||
videojs('example_video_1').somePlugin();
|
||||
|
||||
videojs('example_video_2', {
|
||||
autoplay: true,
|
||||
plugins: {
|
||||
somePlugin: {
|
||||
test: true,
|
||||
},
|
||||
someOtherPluginNotTyped: {},
|
||||
},
|
||||
});
|
||||
|
||||
videojs('example_video_3', {
|
||||
plugins: {},
|
||||
});
|
||||
@ -19,7 +19,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"video.js-some-plugin.d.ts",
|
||||
"test/plugin-tests.ts",
|
||||
"video.js-tests.ts"
|
||||
]
|
||||
}
|
||||
16
types/video.js/video.js-some-plugin.d.ts
vendored
16
types/video.js/video.js-some-plugin.d.ts
vendored
@ -1,16 +0,0 @@
|
||||
// this is not the actual definition file, just an example augmentation
|
||||
/* tslint:disable:no-self-import no-declare-current-package */
|
||||
|
||||
import { VideoJsPlayer } from 'video.js';
|
||||
|
||||
declare module 'video.js' {
|
||||
interface VideoJsPlayer {
|
||||
somePluginDefinedInAugmentation(options?: {}): this;
|
||||
}
|
||||
|
||||
interface VideoJsPlayerPluginOptions {
|
||||
somePluginDefinedInAugmentation: {
|
||||
someRequiredProperty: boolean;
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -69,8 +69,6 @@ videojs("example_video_1").ready(function() {
|
||||
|
||||
testPlugin(this, {});
|
||||
|
||||
testAugmentation(this);
|
||||
|
||||
testLogger();
|
||||
});
|
||||
|
||||
@ -120,21 +118,6 @@ function testPlugin(player: videojs.Player, options: {}) {
|
||||
(player as any).uloztoExample(options);
|
||||
}
|
||||
|
||||
function testAugmentation(player: videojs.Player) {
|
||||
player.somePluginDefinedInAugmentation();
|
||||
videojs('example_video_2', {
|
||||
plugins: {
|
||||
somePluginDefinedInAugmentation: {
|
||||
someRequiredProperty: true
|
||||
},
|
||||
someOtherPluginNotTyped: {},
|
||||
},
|
||||
});
|
||||
videojs('example_video_3', {
|
||||
plugins: {}
|
||||
});
|
||||
}
|
||||
|
||||
function testLogger() {
|
||||
const mylogger = videojs.log.createLogger('mylogger');
|
||||
const anotherlogger = mylogger.createLogger('anotherlogger');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user