|
1 | | -import {test} from '@playwright/test'; |
| 1 | +import {test, expect} from '@playwright/test'; |
2 | 2 | // eslint-disable-next-line import/no-relative-packages |
3 | 3 | import * as TEST_CONST from '../../example/src/testConstants'; |
4 | | -import {testMarkdownContentStyle, testMarkdownElementHasComputedStyle} from './utils'; |
| 4 | +import {setupInput, testMarkdownContentStyle, testMarkdownElementHasComputedStyle} from './utils'; |
5 | 5 |
|
6 | 6 | test.beforeEach(async ({page}) => { |
7 | 7 | await page.goto(TEST_CONST.LOCAL_URL, {waitUntil: 'load'}); |
@@ -72,3 +72,27 @@ test.describe('markdown content styling', () => { |
72 | 72 | await testMarkdownElementHasComputedStyle({testContent: 'strikethrough_blockquote', propertyName: 'text-decoration', style: blockquoteStyle, page}); |
73 | 73 | }); |
74 | 74 | }); |
| 75 | + |
| 76 | +test.describe('empty input styling', () => { |
| 77 | + test.beforeEach(async ({page}) => { |
| 78 | + await page.click('[data-testid="clear"]'); |
| 79 | + }); |
| 80 | + |
| 81 | + test('placeholder should have correct text', async ({page}) => { |
| 82 | + const placeholder = await page.$eval(`div#${TEST_CONST.INPUT_ID}`, (el) => el.getAttribute('placeholder')); |
| 83 | + expect(placeholder).toBe('Type here...'); |
| 84 | + }); |
| 85 | + |
| 86 | + test('empty input should have visible placeholder', async ({page}) => { |
| 87 | + const inputLocator = await setupInput(page); |
| 88 | + |
| 89 | + const beforeContent = await inputLocator.evaluate((el) => { |
| 90 | + return window.getComputedStyle(el, '::before').getPropertyValue('content'); |
| 91 | + }); |
| 92 | + |
| 93 | + expect([ |
| 94 | + '"Type here..."', // Chromium/WebKit, resolves attr() |
| 95 | + 'attr(placeholder)', // Firefox, literal |
| 96 | + ]).toContain(beforeContent); |
| 97 | + }); |
| 98 | +}); |
0 commit comments