fix content warning should delete when you hide it
This commit is contained in:
parent
307bb56ab9
commit
6f350b68d3
|
@ -2,5 +2,9 @@ import { store } from '../_store/store'
|
||||||
|
|
||||||
export function toggleContentWarningShown (realm) {
|
export function toggleContentWarningShown (realm) {
|
||||||
let shown = store.getComposeData(realm, 'contentWarningShown')
|
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
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,17 +52,17 @@ test('Considers content warnings for length limits', async t => {
|
||||||
.expect(composeLengthIndicator.innerText).eql('500')
|
.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)
|
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')
|
.expect(composeLengthIndicator.innerText).eql('500')
|
||||||
.click(contentWarningButton)
|
.click(contentWarningButton)
|
||||||
.typeText(composeContentWarning, 'my content warning', {paste: true})
|
.expect(composeContentWarning.value).eql('')
|
||||||
.expect(composeLengthIndicator.innerText).eql('482')
|
|
||||||
.click(contentWarningButton)
|
|
||||||
.expect(composeLengthIndicator.innerText).eql('500')
|
|
||||||
.click(contentWarningButton)
|
|
||||||
.expect(composeLengthIndicator.innerText).eql('482')
|
|
||||||
.selectText(composeContentWarning)
|
|
||||||
.pressKey('delete')
|
|
||||||
.expect(composeLengthIndicator.innerText).eql('500')
|
.expect(composeLengthIndicator.innerText).eql('500')
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue