Skip to content

Commit f66cab0

Browse files
committed
fix(core): drawer positioning
- Updated CSS for drawer component to ensure inset styles are applied - Enhanced tests to verify positioning at viewport edges for 'right' and 'bottom' positions. Signed-off-by: Cory Rylan <crylan@nvidia.com>
1 parent 1521595 commit f66cab0

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎projects/core/src/drawer/drawer.css‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ nve-icon-button {
107107
}
108108

109109
:host([position='left']) {
110-
inset: auto auto auto 0;
110+
inset: auto auto auto 0!important;
111111
}
112112

113113
:host([position='right']) {
114-
inset: auto 0 auto auto;
114+
inset: auto 0 auto auto!important;
115115
}
116116

117117
:host([position='top']) {
118-
inset:0 auto auto;
118+
inset:0 auto auto!important;
119119
}
120120

121121
:host([position='bottom']) {
122-
inset: auto auto 0;
122+
inset: auto auto 0!important;
123123
}

‎projects/core/src/drawer/drawer.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,19 @@ describe(Drawer.metadata.tag, () => {
137137
expect(element.getAttribute('position')).toBe('right');
138138
});
139139

140+
it.each(['right','bottom']asconst)('should position at the viewport %s edge',asyncposition=>{
141+
element.position=position;
142+
awaitelementIsStable(element);
143+
144+
constopen=untilEvent(element,'open');
145+
element.showPopover();
146+
awaitopen;
147+
148+
constedge=position==='right' ? 'right' : 'bottom';
149+
constviewportEdge=position==='right' ? window.innerWidth : window.innerHeight;
150+
expect(element.getBoundingClientRect()[edge]).toBe(viewportEdge);
151+
});
152+
140153
it('should reflect modal attribute to DOM',async()=>{
141154
expect(element.hasAttribute('modal')).toBe(false);
142155
element.modal=true;

0 commit comments

Comments
 (0)