-
Notifications
You must be signed in to change notification settings - Fork 0
DTR-4473 CS-11 Scheme inactive warning screen #159
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fddbb4c
DTR-4473 CS-11 Scheme inactive warning screen
Mounkumar d0320bb
DTR-4473 removing unused components
Mounkumar 96e798a
DTR-4473 fix button alignment issue
Mounkumar b62ad0c
DTR-4473 add ids to button and cancel link
Mounkumar 009af99
DTR-4473 add optional id to Link component
Mounkumar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
app/controllers/verify/InactiveSchemeWarningController.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Copyright 2026 HM Revenue & Customs | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package controllers.verify | ||
|
|
||
| import controllers.actions.* | ||
| import play.api.i18n.{I18nSupport, MessagesApi} | ||
| import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} | ||
| import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController | ||
| import views.html.verify.InactiveSchemeWarningView | ||
|
|
||
| import javax.inject.Inject | ||
|
|
||
| class InactiveSchemeWarningController @Inject() ( | ||
| override val messagesApi: MessagesApi, | ||
| identify: IdentifierAction, | ||
| getData: DataRetrievalAction, | ||
| requireData: DataRequiredAction, | ||
| val controllerComponents: MessagesControllerComponents, | ||
| view: InactiveSchemeWarningView | ||
| ) extends FrontendBaseController | ||
| with I18nSupport { | ||
|
|
||
| def onPageLoad: Action[AnyContent] = (identify andThen getData andThen requireData) { implicit request => | ||
| Ok(view()) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| @* | ||
| * Copyright 2026 HM Revenue & Customs | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| *@ | ||
|
|
||
| @import views.html.components._ | ||
|
|
||
| @this( | ||
| layout: templates.Layout, | ||
| heading: H1, | ||
| paragraph: Paragraph, | ||
| warning: WarningInsetText, | ||
| govukButton: GovukButton | ||
| ) | ||
|
|
||
| @()(implicit request: Request[_], messages: Messages) | ||
|
|
||
| @layout(pageTitle = titleNoForm(messages("verify.inactiveSchemeWarning.title"))) { | ||
|
|
||
| @heading(messages("verify.inactiveSchemeWarning.heading")) | ||
|
|
||
| @paragraph(messages("verify.inactiveSchemeWarning.p1")) | ||
| @paragraph(messages("verify.inactiveSchemeWarning.p2")) | ||
|
|
||
| @warning(messages("verify.inactiveSchemeWarning.warningText")) | ||
|
|
||
| <div class="govuk-button-group"> | ||
| @govukButton( | ||
| ButtonViewModel(messages("site.continue")).asLink("#").withAttribute("id" -> "continue-button") | ||
| ) | ||
| <a class="govuk-link" id="cancel-link" href="#">@messages("verify.inactiveSchemeWarning.cancel")</a> | ||
| </div> | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
test/controllers/verify/InactiveSchemeWarningControllerSpec.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Copyright 2026 HM Revenue & Customs | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package controllers.verify | ||
|
|
||
| import base.SpecBase | ||
| import play.api.test.FakeRequest | ||
| import play.api.test.Helpers.* | ||
| import views.html.verify.InactiveSchemeWarningView | ||
|
|
||
| class InactiveSchemeWarningControllerSpec extends SpecBase { | ||
|
|
||
| "InactiveSchemeWarning Controller" - { | ||
|
|
||
| "must return OK and the correct view for a GET" in { | ||
|
|
||
| val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)).build() | ||
|
|
||
| running(application) { | ||
| val request = FakeRequest(GET, controllers.verify.routes.InactiveSchemeWarningController.onPageLoad().url) | ||
|
|
||
| val result = route(application, request).value | ||
|
|
||
| val view = application.injector.instanceOf[InactiveSchemeWarningView] | ||
|
|
||
| status(result) mustEqual OK | ||
| contentAsString(result) mustEqual view()(request, messages(application)).toString | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /* | ||
| * Copyright 2026 HM Revenue & Customs | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package views.verify | ||
|
|
||
| import config.FrontendAppConfig | ||
| import org.jsoup.Jsoup | ||
| import org.scalatest.matchers.must.Matchers | ||
| import org.scalatest.wordspec.AnyWordSpec | ||
| import org.scalatestplus.play.guice.GuiceOneAppPerSuite | ||
| import play.api.i18n.{Lang, Messages, MessagesApi, MessagesImpl} | ||
| import play.api.mvc.Request | ||
| import play.api.test.FakeRequest | ||
| import views.html.verify.InactiveSchemeWarningView | ||
|
|
||
| class InactiveSchemeWarningViewSpec extends AnyWordSpec with Matchers with GuiceOneAppPerSuite { | ||
|
|
||
| implicit val request: Request[_] = | ||
| FakeRequest() | ||
|
|
||
| implicit val messages: Messages = | ||
| MessagesImpl( | ||
| Lang.defaultLang, | ||
| app.injector.instanceOf[MessagesApi] | ||
| ) | ||
|
|
||
| implicit val appConfig: FrontendAppConfig = | ||
| app.injector.instanceOf[FrontendAppConfig] | ||
|
|
||
| private val view: InactiveSchemeWarningView = | ||
| app.injector.instanceOf[InactiveSchemeWarningView] | ||
|
|
||
| "InactiveSchemeWarningView" should { | ||
|
|
||
| "render the page with correct title, heading, paragraphs, warning text and button group links" in { | ||
|
|
||
| val html = | ||
| view()( | ||
| request, | ||
| messages | ||
| ) | ||
|
|
||
| val doc = Jsoup.parse(html.toString()) | ||
|
|
||
| doc.select("title").text() must include( | ||
| messages("verify.inactiveSchemeWarning.title") | ||
| ) | ||
|
|
||
| doc.select("h1").size() mustBe 1 | ||
| doc.select("h1").text() mustBe | ||
| messages("verify.inactiveSchemeWarning.heading") | ||
|
|
||
| val bodyParagraphs = doc.select("p.govuk-body") | ||
|
|
||
| bodyParagraphs.get(0).text() mustBe | ||
| messages("verify.inactiveSchemeWarning.p1") | ||
|
|
||
| bodyParagraphs.get(1).text() mustBe | ||
| messages("verify.inactiveSchemeWarning.p2") | ||
|
|
||
| val warningEl = doc.select(".govuk-inset-text, .govuk-warning-text") | ||
| warningEl.size() mustBe 1 | ||
| warningEl.text() must include( | ||
| messages("verify.inactiveSchemeWarning.warningText") | ||
| ) | ||
|
|
||
| val buttonGroup = doc.select("div.govuk-button-group") | ||
| buttonGroup.size() mustBe 1 | ||
|
|
||
| val continueButton = buttonGroup.select("a.govuk-button") | ||
| continueButton.size() mustBe 1 | ||
| continueButton.text() mustBe | ||
| messages("site.continue") | ||
| continueButton.attr("href") mustBe "#" | ||
|
|
||
| val cancelLink = buttonGroup.select("a.govuk-link") | ||
| cancelLink.size() mustBe 1 | ||
| cancelLink.text() mustBe | ||
| messages("verify.inactiveSchemeWarning.cancel") | ||
| cancelLink.attr("href") mustBe "#" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.