Skip to content

Commit

Permalink
Merge pull request #209 from hmrc/Jonathan/DLS-11139/content-changes
Browse files Browse the repository at this point in the history
DLS-11139: Content changes for resident shares cgt calculator
  • Loading branch information
johno1985 authored Jan 13, 2025
2 parents 559c79c + b0311a4 commit 5a07791
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 59 deletions.
2 changes: 1 addition & 1 deletion app/views/calculation/income/personalAllowance.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h1 class="govuk-heading-xl">@title</h1>
<li>@messages("calc.resident.personalAllowance.list.three")</li>
</ul>

<p class="govuk-body">@messages("calc.resident.personalAllowance.link.text") <a href="https://www.gov.uk/income-tax-rates/current-rates-and-allowances" class="govuk-link">@messages("calc.resident.personalAllowance.link")</a>.</p>
<p class="govuk-body">@messages("calc.resident.personalAllowance.link.text") <a href="https://www.gov.uk/income-tax-rates/current-rates-and-allowances" class="govuk-link" target="_blank">@messages("calc.resident.personalAllowance.link")</a>.</p>

@form(action = postAction) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ <h1 class="govuk-panel__title"><span>@Messages("calc.summary.cgtToPay", TaxYearM

<!-- Calculation Details Section -->
<section id="calcDetails">
<!-- Header -->
<h2 class="govuk-heading-m">@Messages("calc.summary.calculationDetails.heading")</h2>

<table id="yourTotalGain" class="govuk-table">
<caption class="govuk-table__caption govuk-table__caption--m">@Messages("calc.summary.calculationDetails.yourTotalGain")</caption>
Expand Down Expand Up @@ -124,4 +122,4 @@ <h2 class="govuk-heading-m">@Messages("calc.summary.calculationDetails.heading")
@summaryNumericRowPartial("aeaRemaining", Messages("calc.summary.remainingDeductions.aeaLeft", TaxYearModel.convertWithWelsh(taxYear.taxYearSupplied)), 0, hintText = false)
</tbody>
</table>
</section>
</section>
8 changes: 3 additions & 5 deletions conf/messages.cy
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ signOut.message = Er eich diogelwch, byddwn yn eich allgofnodi cyn pen
signOut.keepAliveButtonText = Ewch ati i gyfrifo eich Treth Enillion Cyfalaf
signOut.signOutButtonText = Dileu''ch atebion

calc.checkYourAnswers.tableHeading = Rydych wedi rhoi gwybod i ni
calc.checkYourAnswers.title = Gwirio''ch atebion

calc.common.date.error.beforeMinimum = Nodwch ddyddiad sydd ar ôl 6 4 2015
Expand Down Expand Up @@ -69,7 +68,7 @@ calc.resident.outsideTaxYears.title = Nid yw''r gyfrifiannell hon yn cefnogi''r
calc.resident.personalAllowance.title = Lwfans Personol
calc.resident.personalAllowance.currentYearQuestion = Faint yw''ch Lwfans Personol?
calc.resident.personalAllowance.help = Dyma swm eich incwm nad ydych yn talu treth arno.
calc.resident.personalAllowance.link = Gyfraddau Treth Incwm a Lwfansau Personol
calc.resident.personalAllowance.link = Gyfraddau Treth Incwm a Lwfansau Personol (yn agor tab newydd)
calc.resident.personalAllowance.link.text = Rhagor o wybodaeth am
calc.resident.personalAllowance.list.one = ennill mwy na £100,000
calc.resident.personalAllowance.list.title = Yn y flwyddyn dreth {0}, £{1} oedd Lwfans Personol y DU, oni bai eich bod wedi gwneud y canlynol:
Expand Down Expand Up @@ -144,17 +143,16 @@ calc.resident.shares.disposalValue.error.minimumAmount = Mae''n rhaid i faint y

calc.resident.shares.outsideTaxYears.message.tooEarly = Gallwch ddefnyddio''r gyfrifiannell hon os ydych wedi gwerthu cyfranddaliadau ers 5 Ebrill 2015.

calc.resident.shares.ownerBeforeLegislationStart.help = Os cawsoch eich cyfranddaliadau cyn 31 Mawrth 1982, defnyddiwch y gwerth marchnadol ar 31 Mawrth 1982 i gyfrifo''ch Treth Enillion Cyfalaf. Ar ôl y dyddiad hwn, defnyddiwch y gost wreiddiol.
calc.resident.shares.ownerBeforeLegislationStart.noSelectError = Rhowch wybod i ni a oeddech chi''n berchen ar y cyfranddaliadau cyn 1 Ebrill 1982
calc.resident.shares.ownerBeforeLegislationStart.title = Oeddech chi''n berchen ar y cyfranddaliadau cyn 1 Ebrill 1982?

calc.resident.shares.sellForLess.noSelectError = Rhowch wybod i ni a wnaethoch werthu''r cyfranddaliadau am lai na''u gwerth er mwyn helpu''r prynwr.
calc.resident.shares.sellForLess.question = A wnaethoch werthu''r cyfranddaliadau am lai na''u gwerth er mwyn helpu''r prynwr?

calc.resident.shares.valueBeforeLegislationStart.title = Roeddech yn berchen ar y cyfranddaliadau cyn 1&nbsp;Ebrill&nbsp;1982
calc.resident.shares.valueBeforeLegislationStart.title = Gwerth marchnadol y cyfranddaliadau ar 31 Mawrth 1982
calc.resident.shares.valueBeforeLegislationStart.help = Cewch wybodaeth am y prisiad o''r gyfnewidfa stoc neu siaradwch â''ch brocer stoc neu reolwr eich cronfa.
calc.resident.shares.valueBeforeLegislationStart.hintText = Os oeddech yn berchen ar y cyfranddaliadau gyda rhywun arall, dylech ond nodi gwerth eich cyfran chi o''r cyfranddaliadau.
calc.resident.shares.valueBeforeLegislationStart.information = Os cawsoch eich cyfranddaliadau cyn 31 Mawrth 1982, defnyddiwch y gwerth marchnadol ar 31 Mawrth 1982 i gyfrifo''ch Treth Enillion Cyfalaf.
calc.resident.shares.valueBeforeLegislationStart.information = Defnyddiwch werth marchnadol y cyfranddaliadau ar 31 Mawrth 1982 er mwyn cyfrifo’ch Treth Enillion Cyfalaf.
calc.resident.shares.valueBeforeLegislationStart.question = Beth oedd gwerth y cyfranddaliadau ar 31 Mawrth 1982?
calc.resident.shares.valueBeforeLegislationStart.error.mandatoryAmount = Nodwch beth oedd gwerth y cyfranddaliadau ar 31 Mawrth 1982
calc.resident.shares.valueBeforeLegislationStart.error.invalidAmount = Mae''n rhaid i beth oedd gwerth y cyfranddaliadau ar 31 Mawrth 1982 fod yn y fformat cywir
Expand Down
8 changes: 3 additions & 5 deletions conf/messages.en
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ calc.common.error.invalidAmountNoDecimal = Enter an amount in the correct format

## Check Your Answers ##
calc.checkYourAnswers.title = Check your answers
calc.checkYourAnswers.tableHeading = You have told us

###############################################################################################
## Resident messages ##
Expand Down Expand Up @@ -110,7 +109,7 @@ calc.resident.personalAllowance.list.one = earned more than £100,000
calc.resident.personalAllowance.list.two = claimed Blind Person''s Allowance
calc.resident.personalAllowance.list.three = claimed Marriage Allowance
calc.resident.personalAllowance.link.text = Find out more about
calc.resident.personalAllowance.link = Income tax rates and Personal Allowances
calc.resident.personalAllowance.link = Income tax rates and Personal Allowances (opens in new tab)
calc.resident.personalAllowance.currentYearQuestion = How much is your Personal Allowance?
calc.resident.personalAllowance.error.mandatoryAmount = Enter what your Personal Allowance was for the {0} tax year
calc.resident.personalAllowance.error.invalidAmount = Your Personal Allowance for the {0} tax year must be in the correct format
Expand Down Expand Up @@ -173,9 +172,9 @@ calc.resident.shares.disposalCosts.error.invalidAmount = How much you paid in co
calc.resident.shares.disposalCosts.error.minimumAmount = How much you paid in costs when you sold the shares must be 0 or more

## Worth On messages
calc.resident.shares.valueBeforeLegislationStart.title = You owned the shares before 1&nbsp;April&nbsp;1982
calc.resident.shares.valueBeforeLegislationStart.title = Market value of the shares on 31 March 1982
calc.resident.shares.valueBeforeLegislationStart.question = What were the shares worth on 31 March 1982?
calc.resident.shares.valueBeforeLegislationStart.information = If you had your shares before 31 March 1982, use the market value on 31 March 1982 to work out your Capital Gains Tax.
calc.resident.shares.valueBeforeLegislationStart.information = Use the market value of the shares on 31 March 1982 to work out your Capital Gains Tax.
calc.resident.shares.valueBeforeLegislationStart.help = Get valuation information from the stock exchange or talk to your stockbroker or fund manager.
calc.resident.shares.valueBeforeLegislationStart.hintText = If you owned the shares with someone else, only enter the value of your portion of the shares.
calc.resident.shares.valueBeforeLegislationStart.error.mandatoryAmount = Enter what the shares were worth on 31 March 1982
Expand All @@ -184,7 +183,6 @@ calc.resident.shares.valueBeforeLegislationStart.error.minimumAmount = What the

## Owner Before Legislation Start Messages
calc.resident.shares.ownerBeforeLegislationStart.title = Did you own the shares before 1 April 1982?
calc.resident.shares.ownerBeforeLegislationStart.help = If you had your shares before 31 March 1982, use the market value on 31 March 1982 to work out your Capital Gains Tax. After this date, use the original cost.
calc.resident.shares.ownerBeforeLegislationStart.noSelectError = Tell us if you owned the shares before 1 April 1982

## Worth When Inherited
Expand Down
4 changes: 2 additions & 2 deletions test/assets/MessageLookup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object MessageLookup {
}

object ValueBeforeLegislationStart {
val h1 = "You owned the shares before 1 April 1982"
val h1 = "Market value of the shares on 31 March 1982"
val title = s"$h1 - Calculate your Capital Gains Tax - GOV.UK"
val question = "What were the shares worth on 31 March 1982?"
val helpText = "Get valuation information from the stock exchange or talk to your stockbroker or fund manager."
Expand Down Expand Up @@ -178,7 +178,7 @@ object MessageLookup {
val h1 = "Personal Allowance"
val title = s"$h1 - Calculate your Capital Gains Tax - GOV.UK"
def question(input: String): String = s"In the $input tax year, what was your Personal Allowance?"
val link = "Income tax rates and Personal Allowances"
val link = "Income tax rates and Personal Allowances (opens in new tab)"
val linkText = "Find out more about"
val help = "This is the amount of your income that you do not pay tax on."
def listTitle(yearOne: String, yearTwo: String, value: String): String =
Expand Down
19 changes: 7 additions & 12 deletions test/views/calculation/income/PersonalAllowanceViewSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,21 @@ import assets.DateAsset
import assets.MessageLookup.{PersonalAllowance => messages, Resident => commonMessages}
import common.resident.JourneyKeys
import common.{CommonPlaySpec, Dates, WithCommonFakeApplication}
import config.ApplicationConfig
import controllers.helpers.FakeRequestHelper
import forms.PersonalAllowanceForm
import models.resident.TaxYearModel
import models.resident.income.PersonalAllowanceModel
import org.jsoup.Jsoup
import play.api.data.Form
import play.api.i18n.{Lang, Messages}
import play.api.mvc.{Call, MessagesControllerComponents}
import play.api.mvc.MessagesControllerComponents
import views.html.calculation.income.personalAllowance

class PersonalAllowanceViewSpec extends CommonPlaySpec with WithCommonFakeApplication with FakeRequestHelper {

val postAction: Call = controllers.routes.IncomeController.submitPersonalAllowance
val mockConfig: ApplicationConfig = fakeApplication.injector.instanceOf[ApplicationConfig]
implicit lazy val mockMessage: Messages = fakeApplication.injector.instanceOf[MessagesControllerComponents].messagesApi.preferred(fakeRequest)
val personalAllowanceView: personalAllowance = fakeApplication.injector.instanceOf[personalAllowance]
val fakeLang: Lang = Lang("en")
val injectedForm: PersonalAllowanceForm = fakeApplication.injector.instanceOf[PersonalAllowanceForm]
val personalAllowanceForm: Form[PersonalAllowanceModel] = injectedForm(11000, "2022", fakeLang)
private val postAction = controllers.routes.IncomeController.submitPersonalAllowance
private implicit lazy val mockMessage: Messages = fakeApplication.injector.instanceOf[MessagesControllerComponents].messagesApi.preferred(fakeRequest)
private val personalAllowanceView = fakeApplication.injector.instanceOf[personalAllowance]
private val fakeLang = Lang("en")
private val injectedForm = fakeApplication.injector.instanceOf[PersonalAllowanceForm]
private val personalAllowanceForm = injectedForm(11000, "2022", fakeLang)

"Personal Allowance view" when {

Expand Down
18 changes: 3 additions & 15 deletions test/views/calculation/summary/SharesFinalSummaryViewSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@ package views.calculation.summary

import assets.MessageLookup.{Resident => residentMessages, SummaryDetails => summaryMessages, SummaryPage => messages}
import common.{CommonPlaySpec, Dates, WithCommonFakeApplication}
import config.ApplicationConfig
import controllers.helpers.FakeRequestHelper
import models.resident._
import models.resident.income.{CurrentIncomeModel, PersonalAllowanceModel}
import models.resident.shares.{DeductionGainAnswersModel, GainAnswersModel}
import org.jsoup.Jsoup
import play.api.i18n.{Lang, Messages}
import play.api.i18n.Messages
import play.api.mvc.MessagesControllerComponents
import views.html.calculation.summary.finalSummary

class SharesFinalSummaryViewSpec extends CommonPlaySpec with WithCommonFakeApplication with FakeRequestHelper {
implicit lazy val mockMessage: Messages = fakeApplication.injector.instanceOf[MessagesControllerComponents].messagesApi.preferred(fakeRequest)
private implicit lazy val mockMessage: Messages = fakeApplication.injector.instanceOf[MessagesControllerComponents].messagesApi.preferred(fakeRequest)

val mockConfig: ApplicationConfig = fakeApplication.injector.instanceOf[ApplicationConfig]
val finalSummaryView: finalSummary = fakeApplication.injector.instanceOf[finalSummary]
val fakeLang: Lang = Lang("en")
private val finalSummaryView = fakeApplication.injector.instanceOf[finalSummary]

"ShareFinalSummaryViewSpec" when {
val incomeAnswers = IncomeAnswersModel(
Expand All @@ -45,7 +42,6 @@ class SharesFinalSummaryViewSpec extends CommonPlaySpec with WithCommonFakeAppli

"the share was sold inside tax years, bought after legislation start," +
" with reliefs and brought forward losses and taxed at both tax bands" should {

val gainAnswers = GainAnswersModel(
disposalDate = Dates.constructDate(10, 10, 2015),
disposalValue = Some(100000),
Expand Down Expand Up @@ -141,14 +137,6 @@ class SharesFinalSummaryViewSpec extends CommonPlaySpec with WithCommonFakeAppli
}

"have a section for the Calculation details" which {

"has a h2 tag" which {

s"has the text '${summaryMessages.howWeWorkedThisOut}'" in {
doc.select("section#calcDetails h2").text shouldBe summaryMessages.howWeWorkedThisOut
}
}

"has a div for total gain" which {

lazy val div = doc.select("#yourTotalGain")
Expand Down
21 changes: 5 additions & 16 deletions test/views/helpers/FinalSummaryPartialViewSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,25 @@
* limitations under the License.
*/

package views.resident.helpers
package views.helpers

import assets.MessageLookup.{SummaryDetails => summaryMessages}
import common.{CommonPlaySpec, Dates, WithCommonFakeApplication}
import controllers.helpers.FakeRequestHelper
import models.resident._
import models.resident.shares._
import org.jsoup.Jsoup
import play.api.i18n.{Lang, Messages}
import play.api.i18n.Messages
import play.api.mvc.MessagesControllerComponents
import views.html.playHelpers.resident.finalSummaryPartial

class FinalSummaryPartialViewSpec extends CommonPlaySpec with WithCommonFakeApplication with FakeRequestHelper {
implicit lazy val mockMessage: Messages = fakeApplication.injector.instanceOf[MessagesControllerComponents].messagesApi.preferred(fakeRequest)
val finalSummaryPartialView = fakeApplication.injector.instanceOf[finalSummaryPartial]
val fakeLang: Lang = Lang("en")

"FinalSummaryPartial" when {
private implicit lazy val mockMessage: Messages = fakeApplication.injector.instanceOf[MessagesControllerComponents].messagesApi.preferred(fakeRequest)
private val finalSummaryPartialView = fakeApplication.injector.instanceOf[finalSummaryPartial]

"FinalSummaryPartial" when {
"the share was sold inside tax years, bought after legislation start," +
" with no brought forward losses and taxed at 18%" should {

val gainAnswers = GainAnswersModel(
disposalDate = Dates.constructDate(10, 10, 2015),
disposalValue = Some(100000),
Expand Down Expand Up @@ -101,14 +98,6 @@ class FinalSummaryPartialViewSpec extends CommonPlaySpec with WithCommonFakeAppl
}

"have a section for the Calculation details" which {

"has a h2 tag" which {

s"has the text '${summaryMessages.howWeWorkedThisOut}'" in {
doc.select("section#calcDetails h2").text shouldBe summaryMessages.howWeWorkedThisOut
}
}

"has a div for total gain" which {

lazy val div = doc.select("#yourTotalGain").get(0)
Expand Down

0 comments on commit 5a07791

Please sign in to comment.