Skip to content

Commit

Permalink
test: add toFill number test
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed May 25, 2021
1 parent b5e359d commit 806b3bf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,16 @@ module.exports = {
'no-param-reassign': 'off',
'no-use-before-define': 'off',
'import/prefer-default-export': 'off',
'no-restricted-globals': [
'error',
{
name: 'fit',
message: 'Do not commit focused tests.',
},
{
name: 'fdescribe',
message: 'Do not commit focused tests.',
},
],
},
}
14 changes: 12 additions & 2 deletions packages/expect-puppeteer/src/matchers/toFill.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('toFill', () => {
expect(value).toBe('')
})

fit('should fill textarea', async () => {
it('should fill textarea', async () => {
await expect(page).toFill(
'[name="notes"]',
'These are \n multiline \n notes',
Expand All @@ -38,7 +38,7 @@ describe('toFill', () => {
expect(value).toBe('These are \n multiline \n notes')
})

fit('should empty the textarea given an empty string', async () => {
it('should empty the textarea given an empty string', async () => {
await expect(page).toFill(
'[name="notes"]',
'These are \n multiline \n notes',
Expand Down Expand Up @@ -70,6 +70,16 @@ describe('toFill', () => {
)
expect(value).toBe('James')
})

it('should fill number input', async () => {
const body = await page.$('body')
await expect(body).toFill('[name="age"]', '10')
const value = await page.evaluate(
() => document.querySelector('[name="age"]').value,
)
expect(value).toBe('10')
})

it('should fill input with custom delay', async () => {
const body = await page.$('body')
await expect(body).toFill('[name="firstName"]', 'James', {
Expand Down
1 change: 1 addition & 0 deletions server/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<form>
<input name="firstName" />
<input name="lastName" />
<input type="number" name="age" />
<textarea name="notes"></textarea>
</form>
<button id="dialog-btn" onclick="window.confirm('Bouh!')">Open dialog</button>
Expand Down

0 comments on commit 806b3bf

Please sign in to comment.