Skip to content

Commit c82a0f3

Browse files
authored
Fix/68518 - Strike through is not applied for quote markdown text (#721)
1 parent c5aeea4 commit c82a0f3

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

WebExample/__tests__/styles.spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {test} from '@playwright/test';
22
// eslint-disable-next-line import/no-relative-packages
33
import * as TEST_CONST from '../../example/src/testConstants';
4-
import {testMarkdownContentStyle} from './utils';
4+
import {testMarkdownContentStyle, testMarkdownElementHasComputedStyle} from './utils';
55

66
test.beforeEach(async ({page}) => {
77
await page.goto(TEST_CONST.LOCAL_URL, {waitUntil: 'load'});
@@ -60,4 +60,15 @@ test.describe('markdown content styling', () => {
6060

6161
await testMarkdownContentStyle({testContent: 'blockquote', style: browserStyle, page});
6262
});
63+
64+
test('blockquote with strikethrough', async ({page, browserName}) => {
65+
let blockquoteStyle = 'line-through';
66+
if (browserName === 'firefox') {
67+
blockquoteStyle = 'line-through rgb(0, 0, 0)';
68+
} else if (browserName === 'chromium') {
69+
blockquoteStyle = 'line-through solid rgb(0, 0, 0)';
70+
}
71+
72+
await testMarkdownElementHasComputedStyle({testContent: 'strikethrough_blockquote', propertyName: 'text-decoration', style: blockquoteStyle, page});
73+
});
6374
});

WebExample/__tests__/utils.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,29 @@ const testMarkdownContentStyle = async ({testContent, style, page, dimmensions}:
103103
}
104104
};
105105

106-
export {setupInput, getCursorPosition, setCursorPosition, getElementStyle, pressCmd, getElementValue, changeMarkdownStyle, setSelection, testMarkdownContentStyle};
106+
const testMarkdownElementHasComputedStyle = async ({testContent, propertyName, style, page}: {testContent: string; propertyName: string; style: string; page: Page}) => {
107+
const inputLocator = await setupInput(page);
108+
109+
const elementHandle = inputLocator.locator('span', {hasText: testContent}).last();
110+
111+
let elementStyle;
112+
if (elementHandle) {
113+
await elementHandle.waitFor({state: 'attached'});
114+
elementStyle = await elementHandle.evaluate((el, property) => window.getComputedStyle(el).getPropertyValue(property), propertyName);
115+
}
116+
117+
expect(elementStyle).toEqual(style);
118+
};
119+
120+
export {
121+
setupInput,
122+
getCursorPosition,
123+
setCursorPosition,
124+
getElementStyle,
125+
pressCmd,
126+
getElementValue,
127+
changeMarkdownStyle,
128+
setSelection,
129+
testMarkdownContentStyle,
130+
testMarkdownElementHasComputedStyle,
131+
};

example/src/testConstants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const EXAMPLE_CONTENT = [
66
'https://expensify.com',
77
'# header1',
88
'> blockquote',
9+
'~sb\n*sbb\n_sbi\n> strikethrough_blockquote\nsbi_\nsbb*\nsb~',
910
'`inline code`',
1011
'```\ncodeblock\n```',
1112
'@here',

src/web/MarkdownTextInput.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,7 @@
7676
-ms-user-select: none;
7777
user-select: none;
7878
}
79+
80+
[class^='react-native-live-markdown-input'] [data-type='strikethrough'] * {
81+
text-decoration: inherit;
82+
}

0 commit comments

Comments
 (0)