fix(icon): fix rtl detail icon for ios (#17016)

Closes #14958
This commit is contained in:
Adam Bradley
2019-01-09 11:31:30 -06:00
committed by GitHub
parent a30f760d92
commit b4f34054ef
2 changed files with 15 additions and 1 deletions

View File

@ -142,13 +142,18 @@ export class Item implements ComponentInterface {
} }
render() { render() {
const { href, detail, mode, win, detailIcon, routerDirection, type } = this; const { href, detail, mode, win, routerDirection, type } = this;
let detailIcon = this.detailIcon;
const clickable = this.isClickable(); const clickable = this.isClickable();
const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div' as any; const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div' as any;
const attrs = TagType === 'button' ? { type } : { href }; const attrs = TagType === 'button' ? { type } : { href };
const showDetail = detail !== undefined ? detail : mode === 'ios' && clickable; const showDetail = detail !== undefined ? detail : mode === 'ios' && clickable;
if (showDetail && detailIcon === 'ios-arrow-forward' && document.dir === 'rtl') {
detailIcon = 'ios-arrow-back';
}
return [ return [
<TagType <TagType
{...attrs} {...attrs}

View File

@ -8,3 +8,12 @@ test('item: icons', async () => {
const compare = await page.compareScreenshot(); const compare = await page.compareScreenshot();
expect(compare).toMatchScreenshot(); expect(compare).toMatchScreenshot();
}); });
test('item: icons-rtl', async () => {
const page = await newE2EPage({
url: '/src/components/item/test/icons?ionic:_testing=true&rtl=true'
});
const compare = await page.compareScreenshot();
expect(compare).toMatchScreenshot();
});