@@ -3,7 +3,8 @@ const ko = require('knockout');
33const browser = require ( 'core/utils/browser' ) ;
44const devices = require ( 'core/devices' ) ;
55
6- require ( '../../../helpers/executeAsyncMock.js' ) ;
6+ require ( 'fluent_blue_light.css!' ) ;
7+ require ( '../../helpers/executeAsyncMock.js' ) ;
78require ( 'integration/knockout' ) ;
89require ( 'bundles/modules/parts/widgets-web' ) ;
910
@@ -146,10 +147,10 @@ const checkThatTestingIsPossible = function() {
146147 return true ;
147148} ;
148149
149- const defaultOptions = {
150+ const options = {
150151 numberBoxAlign : 'right' ,
151152 testVerticalOffset : true ,
152- testSwitchBaseline : true ,
153+ testSwitchBaseline : false ,
153154 testDateBox : true
154155} ;
155156
@@ -180,7 +181,7 @@ const testBaselineOffset = function($labelContainer, $valueContainer) {
180181 $imgForInput = $ ( '<img/>' ) . height ( 1 ) . width ( 1 ) . appendTo ( $valueContainer ) ;
181182 $imgForLabel . closest ( '.dx-field-label' ) . css ( 'whiteSpace' , 'nowrap' ) ;
182183 $imgForInput . closest ( '.dx-field-value' ) . css ( 'whiteSpace' , 'nowrap' ) ;
183- QUnit . assert . roughEqual ( $imgForLabel . offset ( ) . top , $imgForInput . offset ( ) . top , 0 .99) ;
184+ QUnit . assert . roughEqual ( $imgForLabel . offset ( ) . top , $imgForInput . offset ( ) . top , 1 .99) ;
184185 } finally {
185186 $imgForLabel . remove ( ) ;
186187 $imgForInput . remove ( ) ;
@@ -199,16 +200,13 @@ const testVerticalAlign = function($parent, inputSelector, isContainer, testVert
199200 testBaselineOffset ( $label , $valueContainer ) ;
200201} ;
201202
202- module . exports = function ( themeName , options ) {
203+ const testFieldsetsOnPlatform = function ( ) {
203204 if ( ! checkThatTestingIsPossible ( ) ) {
204205 return ;
205206 }
206207
207- options = options || { } ;
208- options = $ . extend ( { } , defaultOptions , options ) ;
209-
210- const runTestModule = function ( themeName ) {
211- moduleWithoutCsp ( themeName , {
208+ const runTestModule = function ( ) {
209+ moduleWithoutCsp ( 'fluent.blue.light' , {
212210 beforeEach : function ( ) {
213211 DevExpress . testing . executeAsyncMock . setup ( ) ;
214212 $ ( '#qunit-fixture' ) . html ( fieldsetFixtureTemplate ) ;
@@ -222,11 +220,15 @@ module.exports = function(themeName, options) {
222220 } ) ;
223221
224222 QUnit . test ( 'Horizontal align for same widgets on and in field-value' , function ( assert ) {
225- const offsetRightForSwitchOnField = getFullOffsetRight ( $ ( '#switchOnField ' + VALUE + ' .dx-switch-wrapper' ) ) ;
226- const offsetRightForSwitchInField = getFullOffsetRight ( $ ( '#switchInField ' + VALUE + ' .dx-switch-wrapper' ) ) ;
223+ const offsetRightForSwitchOnField = getFullOffsetRight ( $ ( '#switchOnField ' + VALUE ) ) ;
224+ const offsetRightForSwitchOnFieldContainer = getFullOffsetRight ( $ ( '#switchOnField ' + VALUE ) . parent ( ) ) ;
225+ const offsetBetweenOnFieldAndInFieldSwitch = offsetRightForSwitchOnFieldContainer - offsetRightForSwitchOnField ;
226+ const offsetRightForSwitchInField = getFullOffsetRight ( $ ( '#switchInField ' + VALUE ) ) ;
227227
228- const offsetRightForCheckboxOnField = getFullOffsetRight ( $ ( '#checkboxOnField ' + VALUE + ' .dx-checkbox-icon' ) ) ;
229- const offsetRightForCheckboxInField = getFullOffsetRight ( $ ( '#checkboxInField ' + VALUE + ' .dx-checkbox-icon' ) ) ;
228+ const offsetRightForCheckboxOnField = getFullOffsetRight ( $ ( '#checkboxOnField ' + VALUE ) ) ;
229+ const offsetRightForCheckboxOnFieldContainer = getFullOffsetRight ( $ ( '#checkboxOnField ' + VALUE ) . parent ( ) ) ;
230+ const offsetBetweenOnFieldAndInFieldCheckbox = offsetRightForCheckboxOnFieldContainer - offsetRightForCheckboxOnField ;
231+ const offsetRightForCheckboxInField = getFullOffsetRight ( $ ( '#checkboxInField ' + VALUE ) ) ;
230232
231233 const offsetLeftForSliderOnField = getFullOffsetLeft ( $ ( '#sliderOnField ' + VALUE + ' .dx-slider-wrapper' ) ) ;
232234 const offsetLeftForSliderInField = getFullOffsetLeft ( $ ( '#sliderInField ' + VALUE + ' .dx-slider-wrapper' ) ) ;
@@ -255,8 +257,8 @@ module.exports = function(themeName, options) {
255257 const offsetLeftForNumberBoxOnField = getFullOffsetLeft ( $ ( '#numberboxOnField ' + VALUE + ' input' ) ) ;
256258 const offsetLeftForNumberBoxInField = getFullOffsetLeft ( $ ( '#numberboxInField ' + VALUE + ' input' ) ) ;
257259
258- assert . equal ( offsetRightForSwitchOnField , offsetRightForSwitchInField , 'Horizontal align for switches' ) ;
259- assert . equal ( offsetRightForCheckboxOnField , offsetRightForCheckboxInField , 'Horizontal align for checkboxes' ) ;
260+ assert . equal ( offsetRightForSwitchOnField + offsetBetweenOnFieldAndInFieldSwitch , offsetRightForSwitchInField , 'Horizontal align for switches' ) ;
261+ assert . equal ( offsetRightForCheckboxOnField + offsetBetweenOnFieldAndInFieldCheckbox , offsetRightForCheckboxInField , 'Horizontal align for checkboxes' ) ;
260262 assert . equal ( offsetLeftForSliderOnField , offsetLeftForSliderInField , 'Horizontal align for sliders' ) ;
261263 assert . equal ( offsetLeftForTextBoxOnField , offsetLeftForTextBoxInField , 'Horizontal align for textboxes' ) ;
262264 assert . equal ( offsetLeftForAutocompleteOnField , offsetLeftForAutocompleteInField , 'Horizontal align for autocompletes' ) ;
@@ -288,7 +290,8 @@ module.exports = function(themeName, options) {
288290
289291 const offsetLeftForSimpleOnField = getFullOffsetLeft ( $ ( '#simpleTextOnField ' + VALUE ) ) ;
290292
291- const paddingTextAreaDifference = 0 ;
293+ const paddingTextAreaDifference = - 2 ;
294+ const paddingLookupDifference = - 1 ;
292295
293296 assert . equal ( offsetLeftForTextBoxOnField , offsetLeftForAutocompleteOnField , 'Horizontal align for textbox and autocomplete' ) ;
294297
@@ -300,7 +303,7 @@ module.exports = function(themeName, options) {
300303
301304 assert . equal ( offsetLeftForDateBoxOnField , offsetLeftForTextAreaOnField + paddingTextAreaDifference , 'Horizontal align for datebox and textarea' ) ;
302305 assert . equal ( offsetLeftForTextAreaOnField + paddingTextAreaDifference , offsetLeftForLookupOnField , 'Horizontal align for textarea and lookup' ) ;
303- assert . equal ( offsetLeftForLookupOnField , offsetLeftForSimpleOnField , 'Horizontal align for lookup and simpletext' ) ;
306+ assert . equal ( offsetLeftForLookupOnField + paddingLookupDifference , offsetLeftForSimpleOnField , 'Horizontal align for lookup and simpletext' ) ;
304307 } ) ;
305308
306309 QUnit . test ( 'Equal width for same widgets on and in field-value' , function ( assert ) {
@@ -396,7 +399,9 @@ module.exports = function(themeName, options) {
396399
397400 QUnit . test ( 'dxTextarea on Field' , function ( assert ) {
398401 const $parent = $ ( '#textareaOnField' ) ;
399- const $label = $parent . find ( LABEL ) ;
402+ const $label = $parent . find ( LABEL )
403+ . css ( 'align-self' , 'flex-start' )
404+ . css ( 'padding-top' , '8px' ) ;
400405 const $valueInput = $parent . find ( VALUE + ' textarea' ) ;
401406
402407 if ( options . verticalOffsetTest ) {
@@ -419,7 +424,9 @@ module.exports = function(themeName, options) {
419424
420425 QUnit . test ( 'dxTextarea in Field' , function ( assert ) {
421426 const $parent = $ ( '#textareaInField' ) ;
422- const $label = $parent . find ( LABEL ) ;
427+ const $label = $parent . find ( LABEL )
428+ . css ( 'align-self' , 'flex-start' )
429+ . css ( 'padding-top' , '8px' ) ;
423430 const $valueInput = $parent . find ( VALUE + ' textarea' ) ;
424431
425432 if ( options . verticalOffsetTest ) {
@@ -443,3 +450,5 @@ module.exports = function(themeName, options) {
443450
444451 runTestModule ( ) ;
445452} ;
453+
454+ testFieldsetsOnPlatform ( ) ;
0 commit comments