Skip to content

Commit d8f27d8

Browse files
committed
test(segment-view): update function for clearing segment value
1 parent 4c0407e commit d8f27d8

File tree

1 file changed

+12
-3
lines changed
  • core/src/components/segment-view/test/basic

1 file changed

+12
-3
lines changed

core/src/components/segment-view/test/basic/index.html

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
<ion-segment-content id="value">Value</ion-segment-content>
6363
</ion-segment-view>
6464

65+
<ion-toolbar>
6566
<ion-segment value="all">
6667
<ion-segment-button content-id="all" value="all">
6768
<ion-label>All</ion-label>
@@ -141,12 +142,20 @@
141142
} else {
142143
currentValue = 'value';
143144
}
145+
144146
segmentView.setContent(currentValue);
145147
}
146148

147-
function clearSegmentValue() {
148-
const segment = document.querySelector('#noValueSegment');
149-
segment.value = undefined;
149+
async function clearSegmentValue() {
150+
const segmentView = document.querySelector('#noValueSegmentView');
151+
segmentView.setContent('no', false);
152+
153+
// Set timeout to ensure the value is cleared after
154+
// the segment content is updated
155+
setTimeout(() => {
156+
const segment = document.querySelector('#noValueSegment');
157+
segment.value = undefined;
158+
});
150159
}
151160
</script>
152161
</ion-app>

0 commit comments

Comments
 (0)