From df25fbebba5fe37e8b94d0d8329a9513a2cb76f9 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Mon, 1 Apr 2019 11:07:11 +0200 Subject: add hasPlugin and getPlugin API methods and tests --- test/test-plugins.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test-plugins.html b/test/test-plugins.html index 13e3692..dfd65b7 100644 --- a/test/test-plugins.html +++ b/test/test-plugins.html @@ -57,6 +57,8 @@ initCounter['PluginD'] += 1; } }; + var PluginE = {}; + Reveal.registerPlugin( 'PluginA', PluginA ); Reveal.registerPlugin( 'PluginB', PluginB ); Reveal.registerPlugin( 'PluginC', PluginC ); @@ -71,7 +73,7 @@ assert.strictEqual( initCounter['PluginB'], 1, 'prevents duplicate registration' ); }); - QUnit.test( 'Can initialie asynchronously', function( assert ) { + QUnit.test( 'Can initialize asynchronously', function( assert ) { assert.expect( 3 ); var done = assert.async( 2 ); @@ -86,6 +88,17 @@ done(); }); } ); + + QUnit.test( 'Can check if plugin is registered', function( assert ) { + assert.strictEqual( Reveal.hasPlugin( 'PluginA' ), true ); + assert.strictEqual( Reveal.hasPlugin( 'PluginE' ), false ); + Reveal.registerPlugin( 'PluginE', PluginE ); + assert.strictEqual( Reveal.hasPlugin( 'PluginE' ), true ); + } ); + + QUnit.test( 'Can retrieve plugin instance', function( assert ) { + assert.strictEqual( Reveal.getPlugin( 'PluginB' ), PluginB ); + } ); -- cgit v1.2.3