fix content warning should delete when you hide it

smoother-timeline-navigation
Nolan Lawson 2018-03-28 18:37:53 -07:00
rodzic 307bb56ab9
commit 6f350b68d3
2 zmienionych plików z 14 dodań i 10 usunięć

Wyświetl plik

@ -2,5 +2,9 @@ import { store } from '../_store/store'
export function toggleContentWarningShown (realm) {
let shown = store.getComposeData(realm, 'contentWarningShown')
store.setComposeData(realm, {contentWarningShown: !shown})
let contentWarning = store.getComposeData(realm, 'contentWarning')
store.setComposeData(realm, {
contentWarning: shown ? contentWarning : '',
contentWarningShown: !shown
})
}

Wyświetl plik

@ -52,17 +52,17 @@ test('Considers content warnings for length limits', async t => {
.expect(composeLengthIndicator.innerText).eql('500')
})
test('Considers hidden content warnings for length limits', async t => {
test('Content warning goes away if you hide it', async t => {
await t.useRole(foobarRole)
.click(contentWarningButton)
.expect(composeContentWarning.value).eql('')
.typeText(composeContentWarning, 'yo', {paste: true})
.expect(composeContentWarning.value).eql('yo')
.expect(composeLengthIndicator.innerText).eql('498')
.click(contentWarningButton)
.expect(composeContentWarning.exists).notOk()
.expect(composeLengthIndicator.innerText).eql('500')
.click(contentWarningButton)
.typeText(composeContentWarning, 'my content warning', {paste: true})
.expect(composeLengthIndicator.innerText).eql('482')
.click(contentWarningButton)
.expect(composeLengthIndicator.innerText).eql('500')
.click(contentWarningButton)
.expect(composeLengthIndicator.innerText).eql('482')
.selectText(composeContentWarning)
.pressKey('delete')
.expect(composeContentWarning.value).eql('')
.expect(composeLengthIndicator.innerText).eql('500')
})