Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💲[Native Checkout] Update pledge button copy #788

Merged
merged 6 commits into from
Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions Library/ViewModels/RewardCardContainerViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private func pledgeButtonTitle(project: Project, reward: Reward) -> String? {
case (.backed(.live), true, _):
return Strings.Manage_your_pledge()
case (.nonBacked(.live), _, true):
return nonBackedPledgeButtonTitle(project: project, reward: reward)
return nonBackedPledgeButtonTitle(reward: reward)
case (.backed(.nonLive), true, _):
return Strings.View_your_pledge()
case (.backed(.nonLive), false, _),
Expand Down Expand Up @@ -150,13 +150,10 @@ private func buttonStyleType(project: Project, reward: Reward) -> ButtonStyleTyp
return .green
}

private func nonBackedPledgeButtonTitle(project: Project, reward: Reward) -> String {
let minimumFormattedAmount = formattedAmountForRewardOrBacking(
project: project,
rewardOrBacking: .init(left: reward)
)

return Strings.rewards_title_pledge_reward_currency_or_more(reward_currency: minimumFormattedAmount)
private func nonBackedPledgeButtonTitle(reward: Reward) -> String {
return reward == Reward.noReward
? Strings.Make_a_pledge_without_a_reward()
: Strings.Select()
}

private func pledgeButtonIsEnabled(project: Project, reward: Reward) -> Bool {
Expand Down
20 changes: 10 additions & 10 deletions Library/ViewModels/RewardCardContainerViewModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ final class RewardCardContainerViewModelTests: TestCase {
self.pledgeButtonEnabled.assertValues([true, true, true, true, false, false, false, true])
self.pledgeButtonHidden.assertValues([false, false, false, false, false, false, false, false])
self.pledgeButtonTitleText.assertValues([
"Pledge £6 or more",
"Pledge £6 or more",
"Pledge £6 or more",
"Pledge £6 or more",
"Select",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use Strings.Select(), Strings.No_longer_available(), and Strings.Make_a_pledge_without_a_reward() instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is an interesting question. I realize we've been fairly inconsistent in tests with this but I'd like to actually do a sweep sometime to change every String assertion to be explicit rather than through Strings.*. I think the reason being that if the underlying string changes we'd actually want our tests to fail and for us to validate whether the test needs to be updated 🤔

cc @Scollaco @ifbarrera for discussion.

"Select",
"Select",
"Select",
"No longer available",
"No longer available",
"No longer available",
"Pledge £1 or more"
"Make a pledge without a reward"
])
}

Expand Down Expand Up @@ -234,14 +234,14 @@ final class RewardCardContainerViewModelTests: TestCase {
self.pledgeButtonEnabled.assertValues([true, true, true, true, false, false, false, true])
self.pledgeButtonHidden.assertValues([false, false, false, false, false, false, false, false])
self.pledgeButtonTitleText.assertValues([
"Pledge £6 or more",
"Pledge £6 or more",
"Pledge £6 or more",
"Pledge £6 or more",
"Select",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too.

"Select",
"Select",
"Select",
"No longer available",
"No longer available",
"No longer available",
"Pledge £1 or more"
"Make a pledge without a reward"
])
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.