blob: f1e6c6c2d93d9fe8fc31d0ddfb30f9299cc46693 [file] [log] [blame]
import { expect } from 'chai';
import { ElementHandle } from 'puppeteer';
import {
loadCachedTestBed,
takeScreenshot,
TestBed,
} from '../../../puppeteer-tests/util';
describe('autogrow-textarea-sk', () => {
let testBed: TestBed;
before(async () => {
testBed = await loadCachedTestBed();
});
let textarea: ElementHandle;
beforeEach(async () => {
await testBed.page.goto(testBed.baseUrl);
await testBed.page.setViewport({ width: 800, height: 600 });
textarea = (await testBed.page.$('textarea'))!;
});
it('should render the demo page', async () => {
// Smoke test.
expect(await testBed.page.$$('autogrow-textarea-sk')).to.have.length(2);
});
describe('screenshots', () => {
it('shows the empty view', async () => {
await takeScreenshot(testBed.page, 'infra-sk', 'autogrow-textarea-sk');
});
it('shows small amount of text without growth', async () => {
await textarea.type("A\nfew\nlines don't grow the textarea");
await takeScreenshot(
testBed.page,
'infra-sk',
'autogrow-textarea-sk_filled'
);
});
it('shows the textarea grows', async () => {
await textarea.type('A\n\n\nlot\n\n\n\nof lines\n\n\n\n\nhere');
await takeScreenshot(
testBed.page,
'infra-sk',
'autogrow-textarea-sk_grow'
);
});
it('shows the textarea shrinks', async () => {
await textarea.type('Two\nLines');
await takeScreenshot(
testBed.page,
'infra-sk',
'autogrow-textarea-sk_shrink'
);
});
});
});