Skip to content

Commit

Permalink
Merge pull request #862 from DFE-Digital/fix/fix-cs-print-button
Browse files Browse the repository at this point in the history
fix: C&S print button
  • Loading branch information
jack-coggin authored Nov 4, 2024
2 parents 99c6151 + b6fa4eb commit b33d427
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
4 changes: 1 addition & 3 deletions src/Dfe.ContentSupport.Web/Views/Shared/_Print.cshtml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
<div class="js-only print-button govuk-!-display-none-print">
<button class="govuk-link print-link-button" data-module="print-link" id="print-link" >Print this page</button>
</div>
<button class="govuk-link print-link-button js-only print-button govuk-!-display-none-print" data-module="print-link" id="print-link">Print this page</button>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('Feedback banner', () => {
it("should be visible when tracking consented", () => {
cy.visit('content/hello-world',
cy.visit('content/digital-technology-asset-register',
{
headers: {
'Cookie': 'user_cookies_preferences=%7B%22UserAcceptsCookies%22%3Atrue%2C%22IsVisible%22%3Afalse%7D'
Expand All @@ -15,7 +15,7 @@ describe('Feedback banner', () => {
});

it("should not exist when tracking consent not given", () => {
cy.visit('content/hello-world',
cy.visit('content/digital-technology-asset-register',
{
headers: {
'Cookie': 'user_cookies_preferences=%7B%22UserAcceptsCookies%22%3Afalse%2C%22IsVisible%22%3Afalse%7D'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('Print button', () => {
beforeEach(() => {
cy.visit('content/hello-world', {
cy.visit('content/digital-technology-asset-register', {
onBeforeLoad(win) {
//Stub the print functionality so we can see if it was called
//Note: could spy instead, but I don't want the print dialog to actually show.
Expand All @@ -10,12 +10,10 @@ describe('Print button', () => {
});

it("should be visible", () => {
cy.get("div.print-button")
cy.get("button#print-link")
.should('exist')
.not("govuk-visually-hidden")
.should('not.have.attr', 'aria-hidden');

cy.get("button#print-link").should("exist");
.and('be.visible')
.and('not.have.attr', 'aria-hidden');
});

it("should print on click", () => {
Expand Down

0 comments on commit b33d427

Please sign in to comment.