File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,12 @@ class Card extends ElementMixin(ThemableMixin(PolylitMixin(LitElement))) {
341341 ` ;
342342 }
343343
344+ /** @protected */
345+ firstUpdated ( ) {
346+ super . firstUpdated ( ) ;
347+ this . _onSlotChange ( ) ;
348+ }
349+
344350 /** @private */
345351 _onSlotChange ( ) {
346352 this . toggleAttribute ( '_m' , this . querySelector ( ':scope > [slot="media"]' ) ) ;
Original file line number Diff line number Diff line change @@ -99,4 +99,20 @@ describe('vaadin-card', () => {
9999 expect ( getCustomTitleElement ( ) ) . to . exist ;
100100 } ) ;
101101 } ) ;
102+
103+ describe ( 'sizing' , ( ) => {
104+ it ( 'should size synchronously' , async ( ) => {
105+ const template = `
106+ <vaadin-card>
107+ <div slot="title">New Message from Olivia</div>
108+ </vaadin-card>` ;
109+
110+ card = fixtureSync ( template ) ;
111+ await nextRender ( ) ;
112+ const height = card . offsetHeight ;
113+
114+ card = fixtureSync ( template ) ;
115+ expect ( card . offsetHeight ) . to . equal ( height ) ;
116+ } ) ;
117+ } ) ;
102118} ) ;
You can’t perform that action at this time.
0 commit comments