fix(components): [el-switch] increase the word count of (in)active-text (#6140)

* fix(components): [el-switch] increase the word count of (in)active-text

* Update packages/components/switch/src/switch.vue

Co-authored-by: btea <2356281422@qq.com>

* Update switch.vue

Co-authored-by: btea <2356281422@qq.com>
This commit is contained in:
Alan Wang 2022-02-21 10:16:21 +08:00 committed by GitHub
parent 46dfd1588e
commit 98b901c221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -49,7 +49,7 @@ describe('Switch.vue', () => {
expect(coreEl.style.backgroundColor).toEqual('rgb(255, 0, 0)')
expect(coreEl.style.width).toEqual('100px')
const leftLabelWrapper = wrapper.find('.el-switch__inner span')
expect(leftLabelWrapper.text()).toEqual('o')
expect(leftLabelWrapper.text()).toEqual('on')
})
test('switch with icons', () => {

View File

@ -57,14 +57,14 @@
:class="[ns.is('text'), checked ? ns.is('show') : ns.is('hide')]"
:aria-hidden="!checked"
>
{{ activeText.substr(0, 1) }}
{{ activeText.substring(0, 3) }}
</span>
<span
v-if="inactiveText"
:class="[ns.is('text'), !checked ? ns.is('show') : ns.is('hide')]"
:aria-hidden="checked"
>
{{ inactiveText.substr(0, 1) }}
{{ inactiveText.substring(0, 3) }}
</span>
</template>
</div>

View File

@ -112,6 +112,7 @@ $switch-font-size: map.merge(
justify-content: center;
align-items: center;
left: 50%;
white-space: nowrap;
.is-icon,
.is-text {
@ -170,6 +171,7 @@ $switch-font-size: map.merge(
.#{$namespace}-switch__inner {
left: 50%;
white-space: nowrap;
margin-left: calc(-1px - var(--el-switch-button-size));
}
}