Issues (121)

tests/tests.js (25 issues)

Labels
Severity
1
QUnit.module( "Utility" );
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
2
3
QUnit.test( "strToValue", function( assert ) {
4
    assert.equal( testapi.strToValue('true'), true );
0 ignored issues
show
The variable testapi seems to be never declared. If this is a global, consider adding a /** global: testapi */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
5
    assert.equal( testapi.strToValue('false'), false );
6
    assert.equal( testapi.strToValue('31'), 31 );
7
    assert.equal( testapi.strToValue('5.5'), 5.5 );
8
    assert.equal( testapi.strToValue('hello'), 'hello' );
9
});
10
11
QUnit.test( "toCamelCase", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
12
    assert.equal( testapi.toCamelCase('my-camel-case'), 'myCamelCase' );
0 ignored issues
show
The variable testapi seems to be never declared. If this is a global, consider adding a /** global: testapi */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
13
    assert.equal( testapi.toCamelCase('my-Camel-Case'), 'myCamelCase' );
14
    assert.notEqual( testapi.toCamelCase('my-'), 'my' );
15
});
16
17
QUnit.test( "readAttributes", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
18
    assert.deepEqual( testapi.readAttributes($('<div miv-attr="value" miv-attr-two="value">')[0]), {
0 ignored issues
show
The variable testapi seems to be never declared. If this is a global, consider adding a /** global: testapi */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
19
        attr: "value",
20
        attrTwo: "value"
21
    });
22
    assert.deepEqual( testapi.readAttributes($('<div miv-bool="true" miv-number="14">')[0]), {
23
        bool: true,
24
        number: 14
25
    });
26
});
27
28
QUnit.test( "average", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
29
    assert.equal( testapi.average([2,4,6]), 4 );
0 ignored issues
show
The variable testapi seems to be never declared. If this is a global, consider adding a /** global: testapi */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
30
    assert.equal( testapi.average([1.5,7.5,3]),  4);
31
    assert.equal( testapi.average(['1.5',7.5,3]),  4);
32
});
33
34
QUnit.test( "min", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
35
    assert.equal( testapi.min([2,4,6]), 2 );
0 ignored issues
show
The variable testapi seems to be never declared. If this is a global, consider adding a /** global: testapi */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
36
    assert.equal( testapi.min([1.5,7.5,3]),  1.5);
37
    assert.equal( testapi.min([-3,2,3]),  -3);
38
});
39
40
QUnit.test( "max", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
41
    assert.equal( testapi.max([2,4,6]), 6 );
0 ignored issues
show
The variable testapi seems to be never declared. If this is a global, consider adding a /** global: testapi */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
42
    assert.equal( testapi.max([1.5,7.5,3]),  7.5);
43
    assert.equal( testapi.max([-1.5,7.5,9]),  9);
44
});
45
46
QUnit.test( "getEditorHeight", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
47
    $('#utility-test').mivhak();
48
    var $editor = $($('#utility-test').data('mivhak').activeTab.resource.pre),
49
        expectedHeight = $('#utility-test').find('.ace_text-layer').children().height()*3;
50
    assert.equal( testapi.getEditorHeight($editor), expectedHeight );
0 ignored issues
show
The variable testapi seems to be never declared. If this is a global, consider adding a /** global: testapi */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
51
});
52
53
QUnit.test( "strToRange", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
54
    assert.deepEqual( testapi.strToRange('3'), [{start:2,end:2}] );
0 ignored issues
show
The variable testapi seems to be never declared. If this is a global, consider adding a /** global: testapi */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
55
    assert.deepEqual( testapi.strToRange('3, 5-7'), [{start:2,end:2},{start:4,end:6}] );
56
    assert.deepEqual( testapi.strToRange('3  , 5 - 7'), [{start:2,end:2},{start:4,end:6}] );
57
});
58
59
QUnit.module( "Core" );
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
60
61
QUnit.test( "setOptions", function( assert ) {
62
    var options = $.extend(true, {}, testapi.mivhak.defaults);
0 ignored issues
show
The variable testapi seems to be never declared. If this is a global, consider adding a /** global: testapi */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
63
    options.collapsed = true;
64
    $('#set-options-test').mivhak(options);
65
    assert.equal( testapi.mivhak.defaults.collapsed, false);
66
    assert.equal( $('#set-options-test').data('mivhak').options.collapsed, true);
67
    assert.equal( $('#set-options-test').hasClass('mivhak-collapsed'), true);
68
});
69
70
QUnit.test( "updateOptions", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
71
    $('#set-options-test').mivhak();
72
    assert.equal( $('#set-options-test').data('mivhak').options.collapsed, false);
73
    assert.equal( $('#set-options-test').hasClass('mivhak-collapsed'), false);
74
    $('#set-options-test').mivhak({collapsed:true});
75
    assert.equal( $('#set-options-test').data('mivhak').options.collapsed, true);
76
    assert.equal( $('#set-options-test').hasClass('mivhak-collapsed'), true);
77
});
78
79
QUnit.module( "Methods" );
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
80
81
QUnit.test( "toggleLineWrap", function( assert ) {
82
    $('#methods-test').mivhak(); // Line wrap is initially set to true
83
    $('#methods-test').mivhak('toggleLineWrap');
84
    assert.equal($('#methods-test').data('mivhak').state.lineWrap, false);
85
    $('#methods-test').mivhak('toggleLineWrap');
86
    assert.equal($('#methods-test').data('mivhak').state.lineWrap, true);
87
});
88
89
QUnit.test( "collapse", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
90
    $('#methods-test').mivhak();
91
    $('#methods-test').mivhak('collapse');
92
    assert.equal( $('#methods-test').data('mivhak').state.collapsed, true);
93
    assert.equal( $('#methods-test').hasClass('mivhak-collapsed'), true);
94
});
95
96
QUnit.test( "expand", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
97
    $('#methods-test').mivhak();
98
    $('#methods-test').mivhak('collapse');
99
    $('#methods-test').mivhak('expand');
100
    assert.equal( $('#methods-test').data('mivhak').state.collapsed, false);
101
    assert.equal( $('#methods-test').hasClass('mivhak-collapsed'), false);
102
});
103
104
QUnit.test( "showTab", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
105
    $('#methods-test').mivhak();
106
    assert.equal( $('#methods-test').data('mivhak').activeTab.resource.lang, 'javascript');
107
    $('#methods-test').mivhak('showTab',1);
108
    assert.equal( $('#methods-test').data('mivhak').activeTab.resource.lang, 'html');
109
});
110
111
QUnit.test( "setHeight", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
112
    var done = assert.async();
113
    $('#methods-test').mivhak();
114
    $('#methods-test').mivhak('setHeight', 150);
115
    // Wait for requestAnimationFrame
116
    setTimeout(function(){
117
        assert.equal( $('#methods-test').data('mivhak').state.height, 150);
118
        assert.equal( $('#methods-test .mivhak-tabs').height(), 150);
119
        done();
120
    },100);
121
});
122
123
QUnit.test( "setAccentColor", function( assert ) {
0 ignored issues
show
The variable QUnit seems to be never declared. If this is a global, consider adding a /** global: QUnit */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
124
    $('#methods-test').mivhak({accentColor: 'rgb(0, 0, 255)'});
125
    assert.equal( $('#methods-test').data('mivhak').options.accentColor, 'rgb(0, 0, 255)');
126
    assert.equal( $('#methods-test').find('.mivhak-top-bar-button').css('color'), 'rgb(0, 0, 255)');
127
});