summaryrefslogtreecommitdiff
blob: 838ba7069b4b4ee318d1e99cdf4c685dda1ae5a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
 * QUnit tests
 *
 * @since 1.9
 *
 * @file
 * @ingroup SRF
 *
 * @licence GNU GPL v2 or later
 * @author mwjames
 */
( function ( $, mw, srf ) {
	'use strict';

	QUnit.module( 'ext.srf.widgets.panel', QUnit.newMwEnvironment() );

	var pass  = 'Passes because ';

	/**
	 * Instance testing
	 *
	 * @since  1.9
	 */
	QUnit.test( 'instance', 1, function ( assert ) {
		var result;
		var context = $( '<div class="test"></div>', '#qunit-fixture' );

		result = context.panel( {
			'show': true
		} );
		assert.ok( result.find( '.srf-panel') , pass + 'the srf.panel widget returned a DOM object' );

	} );

	/**
	 * Portlet testing
	 *
	 * @since  1.9
	 */
	QUnit.test( 'add portlet', 1, function ( assert ) {
		var result;
		var context = $( '<div class="test"></div>', '#qunit-fixture' );

		result = context.panel( {
			'show': true
		} );

		result = result.panel( 'portlet', {
			'class'  : 'portlet',
			'title'  : 'portlet',
			'fieldset': true
		} );
		assert.ok( result.find( '.portlet > fieldset' ), pass + 'the srf.panel widget added a portlet' );

	} );

}( jQuery, mediaWiki, semanticFormats ) );