Skip to content
Merged
8 changes: 6 additions & 2 deletions angular/test/base/src/app/tabs-tab1/tabs-tab1.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
<ion-content class="ion-padding">
<h1>Welcome to Tab1</h1>
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
<ion-segment-button value="one">One</ion-segment-button>
<ion-segment-button value="two">Two</ion-segment-button>
<ion-segment-button value="one">
<ion-label>One</ion-label>
</ion-segment-button>
<ion-segment-button value="two">
<ion-label>Two</ion-label>
</ion-segment-button>
</ion-segment>
<p>
Segment changed: <span class="segment-changed">{{changed}}</span>
Expand Down
8 changes: 6 additions & 2 deletions angular/test/base/src/app/tabs-tab2/tabs-tab2.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
<ion-content class="ion-padding">
<h1>Welcome to Tab 2</h1>
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
<ion-segment-button value="one">One</ion-segment-button>
<ion-segment-button value="two">Two</ion-segment-button>
<ion-segment-button value="one">
<ion-label>One</ion-label>
</ion-segment-button>
<ion-segment-button value="two">
<ion-label>Two</ion-label>
</ion-segment-button>
</ion-segment>
<p>
Segment changed: <span class="segment-changed">{{changed}}</span>
Expand Down
1 change: 0 additions & 1 deletion core/src/components/segment-button/segment-button.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

position: relative;

flex-basis: 0;
flex-direction: row;

min-width: #{$segment-button-ios-min-width};
Expand Down
1 change: 0 additions & 1 deletion core/src/components/segment-button/segment-button.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

min-width: $segment-button-md-min-width;

max-width: $segment-button-md-max-width;
min-height: $segment-button-md-min-height;

border-width: var(--border-width);
Expand Down
13 changes: 9 additions & 4 deletions core/src/components/segment-button/segment-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@

position: relative;

flex: 1 1 auto;
flex-direction: column;

height: auto;
Expand All @@ -71,9 +70,11 @@

white-space: nowrap;

font-kerning: none;

cursor: pointer;

grid-row: 1;

font-kerning: none;
}

.button-native {
Expand Down Expand Up @@ -210,12 +211,16 @@

align-self: center;

max-width: 100%;

line-height: 22px;

text-overflow: ellipsis;

white-space: nowrap;

overflow: hidden;

box-sizing: border-box;

pointer-events: none;
Expand Down Expand Up @@ -310,4 +315,4 @@ ion-ripple-effect {
.segment-button-indicator-animated {
transition: none;
}
}
}
2 changes: 2 additions & 0 deletions core/src/components/segment/segment.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

:host {
--background: transparent;

grid-auto-columns: minmax(auto, $segment-button-md-max-width);
}

// Segment: In Toolbar
Expand Down
6 changes: 5 additions & 1 deletion core/src/components/segment/segment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

@include font-smoothing();

display: flex;
display: grid;

grid-auto-columns: 1fr;

position: relative;

Expand Down Expand Up @@ -41,6 +43,8 @@
width: auto;

overflow-x: auto;

grid-auto-columns: minmax(min-content, 1fr);
}

:host(.segment-scrollable::-webkit-scrollbar) {
Expand Down
78 changes: 58 additions & 20 deletions core/src/components/segment/test/basic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,53 +23,91 @@

<ion-toolbar>
<ion-segment class="event-tester" value="Free">
<ion-segment-button value="Paid"> PaidPaidPaid </ion-segment-button>
Comment thread
brandyscarney marked this conversation as resolved.
Resolved
<ion-segment-button value="Free"> Free </ion-segment-button>
<ion-segment-button value="Top"> Top </ion-segment-button>
<ion-segment-button value="Paid">
<ion-label>PaidPaidPaid</ion-label>
</ion-segment-button>
<ion-segment-button value="Free">
<ion-label>Free</ion-label>
</ion-segment-button>
<ion-segment-button value="Top">
<ion-label>Top</ion-label>
</ion-segment-button>
</ion-segment>
</ion-toolbar>

<ion-toolbar>
<ion-segment value="2" scrollable="true">
<ion-segment-button value="1">Button 1</ion-segment-button>
<ion-segment-button value="2">Button 3</ion-segment-button>
<ion-segment-button value="3">Button 3</ion-segment-button>
<ion-segment-button value="4">Button 4</ion-segment-button>
<ion-segment-button value="5">Button 5</ion-segment-button>
<ion-segment-button value="6">Button 6</ion-segment-button>
<ion-segment-button value="1">
<ion-label>Button 1</ion-label>
</ion-segment-button>
<ion-segment-button value="2">
<ion-label>Button 2</ion-label>
</ion-segment-button>
<ion-segment-button value="3">
<ion-label>Button 3</ion-label>
</ion-segment-button>
<ion-segment-button value="4">
<ion-label>Button 4</ion-label>
</ion-segment-button>
<ion-segment-button value="5">
<ion-label>Button 5</ion-label>
</ion-segment-button>
<ion-segment-button value="6">
<ion-label>Button 6</ion-label>
</ion-segment-button>
</ion-segment>
</ion-toolbar>

<ion-toolbar>
<ion-segment name="dynamicPropDisable" disabled color="danger">
<ion-segment-button value="Bookmarks"> Bookmarks </ion-segment-button>
<ion-segment-button value="Reading List"> Reading List </ion-segment-button>
<ion-segment-button value="Shared Links"> Shared Links </ion-segment-button>
<ion-segment-button value="Bookmarks">
<ion-label>Bookmarks</ion-label>
</ion-segment-button>
<ion-segment-button value="Reading List">
<ion-label>Reading List</ion-label>
</ion-segment-button>
<ion-segment-button value="Shared Links">
<ion-label>Shared Links</ion-label>
</ion-segment-button>
</ion-segment>
</ion-toolbar>

<ion-toolbar>
<ion-segment name="dynamicAttrElem" color="secondary" value="active">
<ion-segment-button value="active"> Active </ion-segment-button>
<ion-segment-button value="active">
<ion-label>Active</ion-label>
</ion-segment-button>
<ion-segment-button name="dynamicAttrDisable" value="disabled" disabled="true">
Disabled
<ion-label>Disabled</ion-label>
</ion-segment-button>
<ion-segment-button value="inactive" disabled="false">
<ion-label>Inactive</ion-label>
</ion-segment-button>
<ion-segment-button value="inactive" disabled="false"> Inactive </ion-segment-button>
</ion-segment>
</ion-toolbar>

<ion-toolbar>
<ion-segment value="all">
<ion-segment-button value="all"> All </ion-segment-button>
<ion-segment-button value="missed"> Missed </ion-segment-button>
<ion-segment-button value="all">
<ion-label>All</ion-label>
</ion-segment-button>
<ion-segment-button value="missed">
<ion-label>Missed</ion-label>
</ion-segment-button>
</ion-segment>
</ion-toolbar>
</ion-header>

<ion-segment value="segment">
<ion-segment-button value="segment"> Segment </ion-segment-button>
<ion-segment-button value="outside"> Outside </ion-segment-button>
<ion-segment-button value="content"> Content </ion-segment-button>
<ion-segment-button value="segment">
<ion-label>Segment</ion-label>
</ion-segment-button>
<ion-segment-button value="outside">
<ion-label>Outside</ion-label>
</ion-segment-button>
<ion-segment-button value="content">
<ion-label>Content</ion-label>
</ion-segment-button>
</ion-segment>

<ion-content>
Expand Down
48 changes: 36 additions & 12 deletions core/src/components/segment/test/basic/segment.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ configs().forEach(({ title, screenshot, config }) => {
await page.setContent(
`
<ion-segment>
<ion-segment-button value="a">First</ion-segment-button>
<ion-segment-button value="b">Second</ion-segment-button>
<ion-segment-button value="c">Third</ion-segment-button>
<ion-segment-button value="a">
<ion-label>First</ion-label>
</ion-segment-button>
<ion-segment-button value="b">
<ion-label>Second</ion-label>
</ion-segment-button>
<ion-segment-button value="c">
<ion-label>Third</ion-label>
</ion-segment-button>
</ion-segment>
`,
config
Expand All @@ -23,9 +29,15 @@ configs().forEach(({ title, screenshot, config }) => {
await page.setContent(
`
<ion-segment value="a">
<ion-segment-button value="a">First</ion-segment-button>
<ion-segment-button value="b">Second</ion-segment-button>
<ion-segment-button value="c">Third</ion-segment-button>
<ion-segment-button value="a">
<ion-label>First</ion-label>
</ion-segment-button>
<ion-segment-button value="b">
<ion-label>Second</ion-label>
</ion-segment-button>
<ion-segment-button value="c">
<ion-label>Third</ion-label>
</ion-segment-button>
</ion-segment>
`,
config
Expand All @@ -47,9 +59,15 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
await page.setContent(
`
<ion-segment value="b">
<ion-segment-button value="a">First</ion-segment-button>
<ion-segment-button value="b" disabled="true">Second</ion-segment-button>
<ion-segment-button value="c">Third</ion-segment-button>
<ion-segment-button value="a">
<ion-label>First</ion-label>
</ion-segment-button>
<ion-segment-button value="b" disabled="true">
<ion-label>Second</ion-label>
</ion-segment-button>
<ion-segment-button value="c">
<ion-label>Third</ion-label>
</ion-segment-button>
</ion-segment>
`,
config
Expand All @@ -64,9 +82,15 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
await page.setContent(
`
<ion-segment value="b" color="danger">
<ion-segment-button value="a">First</ion-segment-button>
<ion-segment-button value="b">Second</ion-segment-button>
<ion-segment-button value="c">Third</ion-segment-button>
<ion-segment-button value="a">
<ion-label>First</ion-label>
</ion-segment-button>
<ion-segment-button value="b">
<ion-label>Second</ion-label>
</ion-segment-button>
<ion-segment-button value="c">
<ion-label>Third</ion-label>
</ion-segment-button>
</ion-segment>
`,
config
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 27 additions & 9 deletions core/src/components/segment/test/scrollable/segment.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,33 @@ configs().forEach(({ title, screenshot, config }) => {
await page.setContent(
`
<ion-segment scrollable="true" value="2">
<ion-segment-button value="1">First</ion-segment-button>
<ion-segment-button value="2">Second</ion-segment-button>
<ion-segment-button value="3">Third</ion-segment-button>
<ion-segment-button value="4">Fourth</ion-segment-button>
<ion-segment-button value="5">Fifth</ion-segment-button>
<ion-segment-button value="6">Sixth</ion-segment-button>
<ion-segment-button value="7">Seventh</ion-segment-button>
<ion-segment-button value="8">Eigth</ion-segment-button>
<ion-segment-button value="9">Nineth</ion-segment-button>
<ion-segment-button value="1">
<ion-label>First</ion-label>
</ion-segment-button>
<ion-segment-button value="2">
<ion-label>Second</ion-label>
</ion-segment-button>
<ion-segment-button value="3">
<ion-label>Third</ion-label>
</ion-segment-button>
<ion-segment-button value="4">
<ion-label>Fourth</ion-label>
</ion-segment-button>
<ion-segment-button value="5">
<ion-label>Fifth</ion-label>
</ion-segment-button>
<ion-segment-button value="6">
<ion-label>Sixth</ion-label>
</ion-segment-button>
<ion-segment-button value="7">
<ion-label>Seventh</ion-label>
</ion-segment-button>
<ion-segment-button value="8">
<ion-label>Eighth</ion-label>
</ion-segment-button>
<ion-segment-button value="9">
<ion-label>Ninth</ion-label>
</ion-segment-button>
</ion-segment>
`,
config
Expand Down
Loading