|
|
|
@ -233,6 +233,69 @@ class ThreadDisappearingMessagesSettingsViewModelSpec: QuickSpec {
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
context("change to another setting and change back") {
|
|
|
|
|
// Change to another setting
|
|
|
|
|
viewModel.tableData.first?.elements.first?.onTap?()
|
|
|
|
|
// Change back
|
|
|
|
|
viewModel.tableData.first?.elements.last?.onTap?()
|
|
|
|
|
|
|
|
|
|
it("shows the previous setting with no set button") {
|
|
|
|
|
expect(viewModel.tableData.first?.elements.last)
|
|
|
|
|
.to(
|
|
|
|
|
equal(
|
|
|
|
|
SessionCell.Info(
|
|
|
|
|
id: ThreadDisappearingMessagesSettingsViewModel.Item(
|
|
|
|
|
title: "DISAPPERING_MESSAGES_TYPE_AFTER_SEND_TITLE".localized()
|
|
|
|
|
),
|
|
|
|
|
title: "DISAPPERING_MESSAGES_TYPE_AFTER_SEND_TITLE".localized(),
|
|
|
|
|
subtitle: "DISAPPERING_MESSAGES_TYPE_AFTER_SEND_DESCRIPTION".localized(),
|
|
|
|
|
rightAccessory: .radio(
|
|
|
|
|
isSelected: { true }
|
|
|
|
|
),
|
|
|
|
|
accessibility: Accessibility(
|
|
|
|
|
identifier: "Disappear after send option",
|
|
|
|
|
label: "Disappear after send option"
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
let title: String = (DisappearingMessagesConfiguration.validDurationsSeconds(.disappearAfterSend).last?
|
|
|
|
|
.formatted(format: .long))
|
|
|
|
|
.defaulting(to: "")
|
|
|
|
|
expect(viewModel.tableData.first?.elements.last)
|
|
|
|
|
.to(
|
|
|
|
|
equal(
|
|
|
|
|
SessionCell.Info(
|
|
|
|
|
id: ThreadDisappearingMessagesSettingsViewModel.Item(title: title),
|
|
|
|
|
position: .bottom,
|
|
|
|
|
title: title,
|
|
|
|
|
rightAccessory: .radio(
|
|
|
|
|
isSelected: { true }
|
|
|
|
|
),
|
|
|
|
|
accessibility: Accessibility(
|
|
|
|
|
identifier: "Time option",
|
|
|
|
|
label: "Time option"
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var footerButtonInfo: SessionButton.Info?
|
|
|
|
|
|
|
|
|
|
cancellables.append(
|
|
|
|
|
viewModel.footerButtonInfo
|
|
|
|
|
.receiveOnMain(immediately: true)
|
|
|
|
|
.sink(
|
|
|
|
|
receiveCompletion: { _ in },
|
|
|
|
|
receiveValue: { info in footerButtonInfo = info }
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
expect(footerButtonInfo).to(beNil())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
it("has no footer button") {
|
|
|
|
|