add test for compose limits
This commit is contained in:
parent
4ef576b7f1
commit
b6eb997893
|
@ -0,0 +1,34 @@
|
||||||
|
import {
|
||||||
|
composeButton, composeInput, composeLengthIndicator, getUrl, homeNavButton, notificationsNavButton
|
||||||
|
} from '../utils'
|
||||||
|
import { foobarRole } from '../roles'
|
||||||
|
import times from 'lodash/times'
|
||||||
|
|
||||||
|
fixture`12-compose-limits.js`
|
||||||
|
.page`http://localhost:4002`
|
||||||
|
|
||||||
|
test('shows compose limits', async t => {
|
||||||
|
await t.useRole(foobarRole)
|
||||||
|
.hover(composeInput)
|
||||||
|
.expect(composeLengthIndicator.innerText).eql('0')
|
||||||
|
.expect(composeButton.getAttribute('disabled')).eql('')
|
||||||
|
.typeText(composeInput, 'typing some text')
|
||||||
|
.expect(composeLengthIndicator.innerText).eql('16')
|
||||||
|
.expect(composeButton.hasAttribute('disabled')).notOk()
|
||||||
|
.typeText(composeInput, times(50, () => 'hello world').join(' '), {replace: true, paste: true})
|
||||||
|
.expect(composeLengthIndicator.innerText).eql('-99')
|
||||||
|
.expect(composeButton.getAttribute('disabled')).eql('')
|
||||||
|
.typeText(composeInput, 'hello world', {replace: true})
|
||||||
|
.click(notificationsNavButton)
|
||||||
|
.expect(getUrl()).contains('/notifications')
|
||||||
|
.click(homeNavButton)
|
||||||
|
.expect(getUrl()).eql('http://localhost:4002/')
|
||||||
|
.expect(composeInput.value).eql('hello world')
|
||||||
|
.expect(composeLengthIndicator.innerText).eql('11')
|
||||||
|
.expect(composeButton.hasAttribute('disabled')).notOk()
|
||||||
|
.selectText(composeInput)
|
||||||
|
.pressKey('delete')
|
||||||
|
.expect(composeInput.value).eql('')
|
||||||
|
.expect(composeLengthIndicator.innerText).eql('0')
|
||||||
|
.expect(composeButton.getAttribute('disabled')).eql('')
|
||||||
|
})
|
|
@ -10,6 +10,9 @@ export const closeDialogButton = $('.close-dialog-button')
|
||||||
export const notificationsNavButton = $('nav a[href="/notifications"]')
|
export const notificationsNavButton = $('nav a[href="/notifications"]')
|
||||||
export const homeNavButton = $('nav a[href="/"]')
|
export const homeNavButton = $('nav a[href="/"]')
|
||||||
export const formError = $('.form-error-user-error')
|
export const formError = $('.form-error-user-error')
|
||||||
|
export const composeInput = $('.compose-box-input')
|
||||||
|
export const composeButton = $('.compose-box-button')
|
||||||
|
export const composeLengthIndicator = $('.compose-box-length')
|
||||||
|
|
||||||
export const favoritesCountElement = $('.status-favs-reblogs:nth-child(3)').addCustomDOMProperties({
|
export const favoritesCountElement = $('.status-favs-reblogs:nth-child(3)').addCustomDOMProperties({
|
||||||
innerCount: el => parseInt(el.innerText, 10)
|
innerCount: el => parseInt(el.innerText, 10)
|
||||||
|
|
Loading…
Reference in New Issue