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
58
59
60
|
/**
* QUnit tests
*
* @since 1.9
*
* @file
* @ingroup SMW
*
* @licence GNU GPL v2 or later
* @author mwjames
*/
( function ( $, mw, smw ) {
'use strict';
QUnit.module( 'ext.smw.dataItem.property', QUnit.newMwEnvironment() );
var pass = 'Passes because ';
/**
* Test accessibility
*
* @since: 1.9
*/
QUnit.test( 'instance', function ( assert ) {
assert.expect( 1 );
var result = new smw.dataItem.property( 'Has test' );
assert.ok( result instanceof Object, pass + 'the smw.dataItem.property instance was accessible' );
} );
/**
* Test getLabel
*
* @since: 1.9
*/
QUnit.test( 'getLabel', function ( assert ) {
assert.expect( 1 );
var result = new smw.dataItem.property( 'Has test' );
assert.equal( result.getLabel(), 'Has test', pass + 'a label was returned' );
} );
/**
* Test getHtml
*
* @since: 1.9
*/
QUnit.test( 'getHtml', function ( assert ) {
assert.expect( 2 );
var result = new smw.dataItem.property( 'Has type' );
var href = mw.util.wikiGetlink( 'Property:');
assert.equal( result.getHtml(), 'Has type', pass + 'a text label was returned' );
assert.equal( result.getHtml( true ), '<a href=\"' + href + 'Has_type\">Has type</a>', pass + 'a href link was returned' );
} );
}( jQuery, mediaWiki, semanticMediaWiki ) );
|