Skip to content

Commit 4365133

Browse files
committed
Tests: Tilt at a few style guide windmills
Ref 3c13f4c (cherry picked from commit 906caeb)
1 parent b747537 commit 4365133

File tree

1 file changed

+43
-45
lines changed

1 file changed

+43
-45
lines changed

test/unit/dimensions.js

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ test("height(Function(args))", function() {
134134
});
135135

136136
test("innerWidth()", function() {
137-
expect(6);
137+
expect( 6 );
138138

139139
var $div, div,
140140
$win = jQuery( window ),
@@ -143,19 +143,18 @@ test("innerWidth()", function() {
143143
equal( jQuery( window ).innerWidth(), $win.width(), "Test on window" );
144144
equal( jQuery( document ).innerWidth(), $doc.width(), "Test on document" );
145145

146-
$div = jQuery("#nothiddendiv");
147-
// set styles
146+
$div = jQuery( "#nothiddendiv" );
148147
$div.css({
149148
"margin": 10,
150149
"border": "2px solid #fff",
151150
"width": 30
152151
});
153152

154-
equal($div.innerWidth(), 30, "Test with margin and border");
155-
$div.css("padding", "20px");
156-
equal($div.innerWidth(), 70, "Test with margin, border and padding");
153+
equal( $div.innerWidth(), 30, "Test with margin and border" );
154+
$div.css( "padding", "20px" );
155+
equal( $div.innerWidth(), 70, "Test with margin, border and padding" );
157156
$div.hide();
158-
equal($div.innerWidth(), 70, "Test hidden div");
157+
equal( $div.innerWidth(), 70, "Test hidden div" );
159158

160159
// reset styles
161160
$div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
@@ -166,11 +165,11 @@ test("innerWidth()", function() {
166165
equal( div.innerWidth(), 0, "Make sure that disconnected nodes are handled." );
167166

168167
div.remove();
169-
QUnit.expectJqData( this, $div[0], "olddisplay" );
168+
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
170169
});
171170

172171
test("innerHeight()", function() {
173-
expect(6);
172+
expect( 6 );
174173

175174
var $div, div,
176175
$win = jQuery( window ),
@@ -179,19 +178,18 @@ test("innerHeight()", function() {
179178
equal( jQuery( window ).innerHeight(), $win.height(), "Test on window" );
180179
equal( jQuery( document ).innerHeight(), $doc.height(), "Test on document" );
181180

182-
$div = jQuery("#nothiddendiv");
183-
// set styles
181+
$div = jQuery( "#nothiddendiv" );
184182
$div.css({
185183
"margin": 10,
186184
"border": "2px solid #fff",
187185
"height": 30
188186
});
189187

190-
equal($div.innerHeight(), 30, "Test with margin and border");
191-
$div.css("padding", "20px");
192-
equal($div.innerHeight(), 70, "Test with margin, border and padding");
188+
equal( $div.innerHeight(), 30, "Test with margin and border" );
189+
$div.css( "padding", "20px" );
190+
equal( $div.innerHeight(), 70, "Test with margin, border and padding" );
193191
$div.hide();
194-
equal($div.innerHeight(), 70, "Test hidden div");
192+
equal( $div.innerHeight(), 70, "Test hidden div" );
195193

196194
// reset styles
197195
$div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
@@ -202,11 +200,11 @@ test("innerHeight()", function() {
202200
equal( div.innerHeight(), 0, "Make sure that disconnected nodes are handled." );
203201

204202
div.remove();
205-
QUnit.expectJqData( this, $div[0], "olddisplay" );
203+
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
206204
});
207205

208206
test("outerWidth()", function() {
209-
expect(11);
207+
expect( 11 );
210208

211209
var $div, div,
212210
$win = jQuery( window ),
@@ -217,20 +215,20 @@ test("outerWidth()", function() {
217215
equal( jQuery( document ).outerWidth(), $doc.width(), "Test on document without margin option" );
218216
equal( jQuery( document ).outerWidth( true ), $doc.width(), "Test on document with margin option" );
219217

220-
$div = jQuery("#nothiddendiv");
221-
$div.css("width", 30);
222-
223-
equal($div.outerWidth(), 30, "Test with only width set");
224-
$div.css("padding", "20px");
225-
equal($div.outerWidth(), 70, "Test with padding");
226-
$div.css("border", "2px solid #fff");
227-
equal($div.outerWidth(), 74, "Test with padding and border");
228-
$div.css("margin", "10px");
229-
equal($div.outerWidth(), 74, "Test with padding, border and margin without margin option");
230-
$div.css("position", "absolute");
231-
equal($div.outerWidth(true), 94, "Test with padding, border and margin with margin option");
218+
$div = jQuery( "#nothiddendiv" );
219+
$div.css( "width", 30 );
220+
221+
equal( $div.outerWidth(), 30, "Test with only width set" );
222+
$div.css( "padding", "20px" );
223+
equal( $div.outerWidth(), 70, "Test with padding" );
224+
$div.css( "border", "2px solid #fff" );
225+
equal( $div.outerWidth(), 74, "Test with padding and border" );
226+
$div.css( "margin", "10px" );
227+
equal( $div.outerWidth(), 74, "Test with padding, border and margin without margin option" );
228+
$div.css( "position", "absolute" );
229+
equal( $div.outerWidth( true ), 94, "Test with padding, border and margin with margin option" );
232230
$div.hide();
233-
equal($div.outerWidth(true), 94, "Test hidden div with padding, border and margin with margin option");
231+
equal( $div.outerWidth( true ), 94, "Test hidden div with padding, border and margin with margin option" );
234232

235233
// reset styles
236234
$div.css({ "position": "", "display": "", "border": "", "padding": "", "width": "", "height": "" });
@@ -241,7 +239,7 @@ test("outerWidth()", function() {
241239
equal( div.outerWidth(), 0, "Make sure that disconnected nodes are handled." );
242240

243241
div.remove();
244-
QUnit.expectJqData( this, $div[0], "olddisplay" );
242+
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
245243
});
246244

247245
test("child of a hidden elem (or unconnected node) has accurate inner/outer/Width()/Height() see #9441 #9300", function() {
@@ -353,7 +351,7 @@ test("box-sizing:border-box child of a hidden elem (or unconnected node) has acc
353351
});
354352

355353
test("outerHeight()", function() {
356-
expect(11);
354+
expect( 11 );
357355

358356
var $div, div,
359357
$win = jQuery( window ),
@@ -364,19 +362,19 @@ test("outerHeight()", function() {
364362
equal( jQuery( document ).outerHeight(), $doc.height(), "Test on document without margin option" );
365363
equal( jQuery( document ).outerHeight( true ), $doc.height(), "Test on document with margin option" );
366364

367-
$div = jQuery("#nothiddendiv");
368-
$div.css("height", 30);
369-
370-
equal($div.outerHeight(), 30, "Test with only width set");
371-
$div.css("padding", "20px");
372-
equal($div.outerHeight(), 70, "Test with padding");
373-
$div.css("border", "2px solid #fff");
374-
equal($div.outerHeight(), 74, "Test with padding and border");
375-
$div.css("margin", "10px");
376-
equal($div.outerHeight(), 74, "Test with padding, border and margin without margin option");
377-
equal($div.outerHeight(true), 94, "Test with padding, border and margin with margin option");
365+
$div = jQuery( "#nothiddendiv" );
366+
$div.css( "height", 30 );
367+
368+
equal( $div.outerHeight(), 30, "Test with only width set" );
369+
$div.css( "padding", "20px" );
370+
equal( $div.outerHeight(), 70, "Test with padding" );
371+
$div.css( "border", "2px solid #fff" );
372+
equal( $div.outerHeight(), 74, "Test with padding and border" );
373+
$div.css( "margin", "10px" );
374+
equal( $div.outerHeight(), 74, "Test with padding, border and margin without margin option" );
375+
equal( $div.outerHeight( true ), 94, "Test with padding, border and margin with margin option" );
378376
$div.hide();
379-
equal($div.outerHeight(true), 94, "Test hidden div with padding, border and margin with margin option");
377+
equal( $div.outerHeight( true ), 94, "Test hidden div with padding, border and margin with margin option" );
380378

381379
// reset styles
382380
$div.css({ "display": "", "border": "", "padding": "", "width": "", "height": "" });
@@ -387,7 +385,7 @@ test("outerHeight()", function() {
387385
equal( div.outerHeight(), 0, "Make sure that disconnected nodes are handled." );
388386

389387
div.remove();
390-
QUnit.expectJqData( this, $div[0], "olddisplay" );
388+
QUnit.expectJqData( this, $div[ 0 ], "olddisplay" );
391389
});
392390

393391
test("passing undefined is a setter #5571", function() {

0 commit comments

Comments
 (0)