Skip to content

Commit

Permalink
ran prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
pflynny committed Sep 27, 2023
1 parent 30ae453 commit eaf1c50
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 57 deletions.
36 changes: 18 additions & 18 deletions packages/components/footer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -524,23 +524,23 @@ Find out more about the footer component and when to use it in the [NHS digital

The footer Nunjucks macro takes the following arguments:

| Name | Type | Required | Description |
| ------------------------ | ------ | -------- | --------------------------------------------------------------------------------------------- |
| **bottomBorder** | boolean | No | Set to "false" to remove the grey bottom border in the footer. |
| **links** | array | No | Array of first column of navigation items for use in the footer. |
| **links.[].url** | string | No | The href of a navigation item in the first column of the footer. |
| **links.[].label** | string | No | The label of a navigation item in the first column of the footer.
| **linksColumn2** | array | No | Array of second column of navigation items for use in the footer. |
| **linksColumn2.[].url** | string | No | The href of a navigation item in the second column of the footer. |
| **linksColumn2.[].label** | string | No | The label of a navigation item in the second column of the footer.
| **linksColumn3** | array | No | Array of third column of navigation items for use in the footer. |
| **linksColumn3.[].url** | string | No | The href of a navigation item in the third column of the footer. |
| **linksColumn3.[].label** | string | No | The label of a navigation item in the third column of the footer.
| **classes** | string | No | Optional additional classes to add to the footer container. Separate each class with a space. |
| **attributes** | object | No | Any extra HTML attributes (for example data attributes) to add to the footer container. |
| **copyright** | string | No | The label for the copyright notice in the footer. |
| **metaLinks** | array | No | Array of policy navigation items for use in the footer. |
| **metaLinks.[].url** | string | No | The href of a policy navigation item in the footer. |
| **metaLinks.[].label** | string | No | The label of a policy navigation item in the |
| Name | Type | Required | Description |
| ------------------------- | ------- | -------- | --------------------------------------------------------------------------------------------- |
| **bottomBorder** | boolean | No | Set to "false" to remove the grey bottom border in the footer. |
| **links** | array | No | Array of first column of navigation items for use in the footer. |
| **links.[].url** | string | No | The href of a navigation item in the first column of the footer. |
| **links.[].label** | string | No | The label of a navigation item in the first column of the footer. |
| **linksColumn2** | array | No | Array of second column of navigation items for use in the footer. |
| **linksColumn2.[].url** | string | No | The href of a navigation item in the second column of the footer. |
| **linksColumn2.[].label** | string | No | The label of a navigation item in the second column of the footer. |
| **linksColumn3** | array | No | Array of third column of navigation items for use in the footer. |
| **linksColumn3.[].url** | string | No | The href of a navigation item in the third column of the footer. |
| **linksColumn3.[].label** | string | No | The label of a navigation item in the third column of the footer. |
| **classes** | string | No | Optional additional classes to add to the footer container. Separate each class with a space. |
| **attributes** | object | No | Any extra HTML attributes (for example data attributes) to add to the footer container. |
| **copyright** | string | No | The label for the copyright notice in the footer. |
| **metaLinks** | array | No | Array of policy navigation items for use in the footer. |
| **metaLinks.[].url** | string | No | The href of a policy navigation item in the footer. |
| **metaLinks.[].label** | string | No | The label of a policy navigation item in the |

If you are using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `html` can be a [security risk](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Read more about this in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).
2 changes: 1 addition & 1 deletion packages/components/footer/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
padding-bottom: 0;
padding-right: 40px;
width: 75%;

&:last-child {
padding-right: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/header/_header-organisation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
color: $color_nhsuk-blue;
}

@media (max-width: 450px) {
@media (max-width: 450px) {
font-size: 12px;
line-height: 18px;
}
Expand Down
2 changes: 0 additions & 2 deletions packages/components/header/_header-transactional.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
}

.nhsuk-header--transactional {

.nhsuk-header__container {
justify-content: normal;
}
Expand All @@ -41,7 +40,6 @@
.nhsuk-logo {
@include nhsuk-logo-size-small;
}

}

.nhsuk-header--transactional__logo--only {
Expand Down
25 changes: 9 additions & 16 deletions packages/components/header/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
.nhsuk-header__container {
margin: 0 nhsuk-spacing(3);
max-width: $nhsuk-page-width;
padding: 20px 0;
padding: 20px 0;

@include mq($until: tablet) {
padding-bottom: 0;
Expand All @@ -34,18 +34,16 @@
@include mq($from: tablet) {
border-bottom: 1px solid $color_transparent_nhsuk-white-20;
display: flex;
justify-content:space-between;
justify-content: space-between;
margin: 0 nhsuk-spacing(5);
}
}

@include mq($from: large-desktop) {
margin: 0 auto;
}

}

.nhsuk-header__logo {

@include mq($until: tablet) {
position: relative;
z-index: 1;
Expand Down Expand Up @@ -147,7 +145,6 @@
}

@include mq($from: tablet) {

&.js-show {
border-bottom: 0;
}
Expand All @@ -170,7 +167,7 @@
.nhsuk-header__search-form {
height: 100%;
overflow: visible;

@include mq($until: tablet) {
display: flex;
margin: nhsuk-spacing(3) 0 0;
Expand Down Expand Up @@ -379,7 +376,6 @@
@include mq($from: large-desktop) {
color: $color_nhsuk-white;
}

}

&:active,
Expand All @@ -402,7 +398,6 @@
color: $nhsuk-focus-text-color;
}
}

}

// menu toggle button, only shows when screen can't fit all nav items
Expand All @@ -414,7 +409,7 @@
border-top: nhsuk-spacing(1) solid transparent;
box-sizing: border-box;
cursor: pointer;
margin: 0;
margin: 0;
overflow: visible;
position: relative;
right: 0;
Expand Down Expand Up @@ -443,8 +438,8 @@
}

.nhsuk-header__menu-toggle--visible {
visibility: visible;
display: block;
visibility: visible;
display: block;
}

.nhsuk-icon__chevron-down {
Expand All @@ -460,7 +455,6 @@
position: relative;
z-index: 10;
}

}

%nhsuk-navigation-list {
Expand All @@ -475,7 +469,7 @@
@include govuk-width-container;

width: 100%;

@include mq($from: desktop) {
display: flex;
justify-content: space-between;
Expand All @@ -494,7 +488,6 @@
position: relative;
}


// ul of hidden nav
.nhsuk-header__drop-down {
@extend %nhsuk-navigation-list;
Expand Down
38 changes: 19 additions & 19 deletions tests/integration/jsdom/header.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Header = require('../../../packages/components/header/header');
const Header = require('../../../packages/components/header/header')

describe('Header', () => {
let header;
let header

beforeEach(() => {
document.body.innerHTML = `
Expand All @@ -14,35 +14,35 @@ describe('Header', () => {
<button class="nhsuk-header__menu-toggle"></button>
<div class="nhsuk-mobile-menu-container"></div>
</div>
`;
`

header = Header;
});
header = Header
})

afterEach(() => {
document.body.innerHTML = '';
});
document.body.innerHTML = ''
})

test('mobile menu should open and close properly', () => {
const mobileMenuToggleButton = document.querySelector('.nhsuk-header__menu-toggle');
const mobileMenuToggleButton = document.querySelector('.nhsuk-header__menu-toggle')
console.log(header)
expect(header.menuIsOpen).toBe(false);
expect(header.menuIsOpen).toBe(false)

// Simulate clicking the mobile menu toggle button
mobileMenuToggleButton.click();
expect(header.menuIsOpen).toBe(true);
mobileMenuToggleButton.click()
expect(header.menuIsOpen).toBe(true)

// Simulate clicking the mobile menu close button
header.mobileMenuCloseButton.click();
expect(header.menuIsOpen).toBe(false);
});
header.mobileMenuCloseButton.click()
expect(header.menuIsOpen).toBe(false)
})

test('calculateBreakpoints should set breakpoints correctly', () => {
header.calculateBreakpoints();
const expectedBreakpoints = [90, 175, 260]; // These values are based on the provided DOM structure
header.calculateBreakpoints()
const expectedBreakpoints = [90, 175, 260] // These values are based on the provided DOM structure

expect(header.breakpoints).toEqual(expectedBreakpoints);
});
expect(header.breakpoints).toEqual(expectedBreakpoints)
})

// Add more tests for other methods and functionality
});
})

0 comments on commit eaf1c50

Please sign in to comment.