@@ -4,7 +4,7 @@ import sinon from 'sinon';
44import '@vaadin/text-field/vaadin-text-field.js' ;
55import '../src/vaadin-form-layout.js' ;
66import '../src/vaadin-form-item.js' ;
7- import '@polymer/polymer/lib/elements/dom-repeat .js';
7+ import { FormItem } from '../src/vaadin-form-item .js';
88
99function estimateEffectiveColumnCount ( layout ) {
1010 const offsets = [ ...layout . children ]
@@ -139,6 +139,7 @@ describe('form layout', () => {
139139 } ) ;
140140
141141 afterEach ( ( ) => {
142+ FormItem . __isDeprecationWarningShown = false ;
142143 console . warn . restore ( ) ;
143144 } ) ;
144145
@@ -154,27 +155,36 @@ describe('form layout', () => {
154155 expect ( getComputedStyle ( item ) . getPropertyValue ( '--vaadin-form-item-row-spacing' ) ) . to . be . empty ;
155156 } ) ;
156157
157- it ( 'should warn when adding form-item with deprecated --vaadin-form-item-label-width' , ( ) => {
158- const item = document . createElement ( 'vaadin-form-item' ) ;
159- item . style . setProperty ( '--vaadin-form-item-label-width' , '100px' ) ;
160- layout . appendChild ( item ) ;
161- expect ( console . warn . calledOnce ) . to . be . true ;
158+ it ( 'should warn once when adding form items with deprecated --vaadin-form-item-label-width' , ( ) => {
159+ for ( let i = 0 ; i < 2 ; i ++ ) {
160+ const item = document . createElement ( 'vaadin-form-item' ) ;
161+ item . style . setProperty ( '--vaadin-form-item-label-width' , '100px' ) ;
162+ layout . appendChild ( item ) ;
163+ }
164+
165+ expect ( console . warn ) . to . be . calledOnce ;
162166 expect ( console . warn . args [ 0 ] [ 0 ] ) . to . contain ( '`--vaadin-form-item-label-width` is deprecated' ) ;
163167 } ) ;
164168
165- it ( 'should warn when adding form-item with deprecated --vaadin-form-item-label-spacing' , ( ) => {
166- const item = document . createElement ( 'vaadin-form-item' ) ;
167- item . style . setProperty ( '--vaadin-form-item-label-spacing' , '8px' ) ;
168- layout . appendChild ( item ) ;
169- expect ( console . warn . calledOnce ) . to . be . true ;
169+ it ( 'should warn once when adding form items with deprecated --vaadin-form-item-label-spacing' , ( ) => {
170+ for ( let i = 0 ; i < 2 ; i ++ ) {
171+ const item = document . createElement ( 'vaadin-form-item' ) ;
172+ item . style . setProperty ( '--vaadin-form-item-label-spacing' , '8px' ) ;
173+ layout . appendChild ( item ) ;
174+ }
175+
176+ expect ( console . warn ) . to . be . calledOnce ;
170177 expect ( console . warn . args [ 0 ] [ 0 ] ) . to . contain ( '`--vaadin-form-item-label-spacing` is deprecated' ) ;
171178 } ) ;
172179
173- it ( 'should warn when adding form-item with deprecated --vaadin-form-item-row-spacing' , ( ) => {
174- const item = document . createElement ( 'vaadin-form-item' ) ;
175- item . style . setProperty ( '--vaadin-form-item-row-spacing' , '8px' ) ;
176- layout . appendChild ( item ) ;
177- expect ( console . warn . calledOnce ) . to . be . true ;
180+ it ( 'should warn when adding form items with deprecated --vaadin-form-item-row-spacing' , ( ) => {
181+ for ( let i = 0 ; i < 2 ; i ++ ) {
182+ const item = document . createElement ( 'vaadin-form-item' ) ;
183+ item . style . setProperty ( '--vaadin-form-item-row-spacing' , '8px' ) ;
184+ layout . appendChild ( item ) ;
185+ }
186+
187+ expect ( console . warn ) . to . be . calledOnce ;
178188 expect ( console . warn . args [ 0 ] [ 0 ] ) . to . contain ( '`--vaadin-form-item-row-spacing` is deprecated' ) ;
179189 } ) ;
180190
0 commit comments