2018-03-04 01:12:48 +01:00
|
|
|
import {
|
|
|
|
composeContentWarning, composeInput, composeLengthIndicator, contentWarningButton, homeNavButton,
|
|
|
|
notificationsNavButton
|
|
|
|
} from '../utils'
|
2018-05-26 22:51:41 +02:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-03-04 01:12:48 +01:00
|
|
|
|
2018-03-07 06:32:51 +01:00
|
|
|
fixture`015-compose-content-warnings.js`
|
2018-03-04 01:12:48 +01:00
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('Changes content warnings', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-03-04 01:12:48 +01:00
|
|
|
.expect(composeContentWarning.exists).notOk()
|
|
|
|
.expect(contentWarningButton.getAttribute('aria-label')).eql('Add content warning')
|
2019-11-09 23:25:26 +01:00
|
|
|
.expect(contentWarningButton.getAttribute('title')).eql('Add content warning')
|
2018-03-04 01:12:48 +01:00
|
|
|
.click(contentWarningButton)
|
|
|
|
.expect(composeContentWarning.exists).ok()
|
2019-11-23 20:25:36 +01:00
|
|
|
.expect(contentWarningButton.getAttribute('aria-label')).eql('Remove content warning')
|
2019-11-09 23:25:26 +01:00
|
|
|
.expect(contentWarningButton.getAttribute('title')).eql('Remove content warning')
|
2018-08-30 06:42:57 +02:00
|
|
|
.typeText(composeContentWarning, 'hello content warning', { paste: true })
|
|
|
|
.typeText(composeInput, 'secret text', { paste: true })
|
2018-03-04 01:12:48 +01:00
|
|
|
.click(notificationsNavButton)
|
|
|
|
.click(homeNavButton)
|
2019-11-23 20:25:36 +01:00
|
|
|
.expect(contentWarningButton.getAttribute('aria-label')).eql('Remove content warning')
|
2019-11-09 23:25:26 +01:00
|
|
|
.expect(contentWarningButton.getAttribute('title')).eql('Remove content warning')
|
2018-03-04 01:12:48 +01:00
|
|
|
.expect(composeContentWarning.value).eql('hello content warning')
|
|
|
|
.expect(composeInput.value).eql('secret text')
|
|
|
|
.selectText(composeInput)
|
|
|
|
.pressKey('delete')
|
|
|
|
.selectText(composeContentWarning)
|
|
|
|
.pressKey('delete')
|
|
|
|
.expect(composeContentWarning.value).eql('')
|
|
|
|
.expect(composeInput.value).eql('')
|
|
|
|
.click(contentWarningButton)
|
|
|
|
.expect(composeContentWarning.exists).notOk()
|
|
|
|
.expect(contentWarningButton.getAttribute('aria-label')).eql('Add content warning')
|
2019-11-09 23:25:26 +01:00
|
|
|
.expect(contentWarningButton.getAttribute('title')).eql('Add content warning')
|
2018-03-04 01:12:48 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
test('Considers content warnings for length limits', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-03-04 01:12:48 +01:00
|
|
|
.expect(composeLengthIndicator.innerText).eql('500')
|
|
|
|
.click(contentWarningButton)
|
2018-08-30 06:42:57 +02:00
|
|
|
.typeText(composeContentWarning, 'my content warning', { paste: true })
|
2018-03-04 01:12:48 +01:00
|
|
|
.expect(composeLengthIndicator.innerText).eql('482')
|
2018-08-30 06:42:57 +02:00
|
|
|
.typeText(composeInput, 'secret text', { paste: true })
|
2018-03-04 01:12:48 +01:00
|
|
|
.expect(composeLengthIndicator.innerText).eql('471')
|
|
|
|
.selectText(composeContentWarning)
|
|
|
|
.pressKey('delete')
|
|
|
|
.expect(composeLengthIndicator.innerText).eql('489')
|
|
|
|
.selectText(composeInput)
|
|
|
|
.pressKey('delete')
|
|
|
|
.expect(composeLengthIndicator.innerText).eql('500')
|
|
|
|
})
|
|
|
|
|
2018-03-29 03:37:53 +02:00
|
|
|
test('Content warning goes away if you hide it', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-03-04 01:12:48 +01:00
|
|
|
.click(contentWarningButton)
|
2018-03-29 03:37:53 +02:00
|
|
|
.expect(composeContentWarning.value).eql('')
|
2018-08-30 06:42:57 +02:00
|
|
|
.typeText(composeContentWarning, 'yo', { paste: true })
|
2018-03-29 03:37:53 +02:00
|
|
|
.expect(composeContentWarning.value).eql('yo')
|
|
|
|
.expect(composeLengthIndicator.innerText).eql('498')
|
2018-03-04 01:12:48 +01:00
|
|
|
.click(contentWarningButton)
|
2018-03-29 03:37:53 +02:00
|
|
|
.expect(composeContentWarning.exists).notOk()
|
2018-03-04 01:12:48 +01:00
|
|
|
.expect(composeLengthIndicator.innerText).eql('500')
|
|
|
|
.click(contentWarningButton)
|
2018-03-29 03:37:53 +02:00
|
|
|
.expect(composeContentWarning.value).eql('')
|
2018-03-04 01:12:48 +01:00
|
|
|
.expect(composeLengthIndicator.innerText).eql('500')
|
2018-03-04 01:32:10 +01:00
|
|
|
})
|