@ministryofjustice/frontend
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -202,14 +202,9 @@ /* | ||
test("can navigate back in time", async () => { | ||
const today = new Date(); | ||
const currentMonthName = today.toLocaleString("default", { month: "long" }); | ||
const currentYear = today.getFullYear(); | ||
const currentMonth = today.getMonth(); | ||
const previousMonthName = new Date( | ||
today.setMonth(currentMonth - 1), | ||
).toLocaleString("default", { month: "long" }); | ||
const previousYear = currentYear - 1; | ||
const today = dayjs(); | ||
const previousMonth = dayjs().subtract(1, 'month') | ||
const previousYear = previousMonth.subtract(1, 'year') | ||
const currentTitle = `${currentMonthName} ${currentYear}`; | ||
const previousMonthTitle = `${previousMonthName} ${currentYear}`; | ||
const previousYearTitle = `${previousMonthName} ${previousYear}`; | ||
const currentTitle = `${today.format('MMMM YYYY')}`; | ||
const previousMonthTitle = `${previousMonth.format('MMMM YYYY')}`; | ||
const previousYearTitle = `${previousYear.format('MMMM YYYY')}`; | ||
@@ -228,14 +223,9 @@ await user.click(calendarButton); | ||
test("can navigate forward in time", async () => { | ||
const today = new Date(); | ||
const currentMonthName = today.toLocaleString("default", { month: "long" }); | ||
const currentYear = today.getFullYear(); | ||
const currentMonth = today.getMonth(); | ||
const nextMonthName = new Date( | ||
today.setMonth(currentMonth + 1), | ||
).toLocaleString("default", { month: "long" }); | ||
const nextYear = currentYear + 1; | ||
const today = dayjs(); | ||
const nextMonth = dayjs().add(1, 'month') | ||
const nextYear = nextMonth.add(1, 'year') | ||
const currentTitle = `${currentMonthName} ${currentYear}`; | ||
const nextMonthTitle = `${nextMonthName} ${currentYear}`; | ||
const nextYearTitle = `${nextMonthName} ${nextYear}`; | ||
const currentTitle = `${today.format('MMMM YYYY')}`; | ||
const nextMonthTitle = `${nextMonth.format('MMMM YYYY')}`; | ||
const nextYearTitle = `${nextYear.format('MMMM YYYY')}`; | ||
@@ -242,0 +232,0 @@ await user.click(calendarButton); |
@@ -10,3 +10,9 @@ MOJFrontend.MultiSelect = function(options) { | ||
this.toggle = $(this.getToggleHtml()); | ||
const idPrefix = options.id_prefix; | ||
let allId = 'checkboxes-all'; | ||
if (typeof idPrefix !== 'undefined') { | ||
allId = idPrefix + 'checkboxes-all'; | ||
} | ||
this.toggle = $(this.getToggleHtml(allId)); | ||
this.toggleButton = this.toggle.find('input'); | ||
@@ -20,7 +26,7 @@ this.toggleButton.on('click', $.proxy(this, 'onButtonClick')); | ||
MOJFrontend.MultiSelect.prototype.getToggleHtml = function() { | ||
var html = ''; | ||
MOJFrontend.MultiSelect.prototype.getToggleHtml = function (allId) { | ||
let html = ''; | ||
html += '<div class="govuk-checkboxes__item govuk-checkboxes--small moj-multi-select__checkbox">'; | ||
html += ' <input type="checkbox" class="govuk-checkboxes__input" id="checkboxes-all">'; | ||
html += ' <label class="govuk-label govuk-checkboxes__label moj-multi-select__toggle-label" for="checkboxes-all">'; | ||
html += ` <input type="checkbox" class="govuk-checkboxes__input" id="${allId}">`; | ||
html += ` <label class="govuk-label govuk-checkboxes__label moj-multi-select__toggle-label" for="${allId}">`; | ||
html += ' <span class="govuk-visually-hidden">Select all</span>'; | ||
@@ -27,0 +33,0 @@ html += ' </label>'; |
# Table multi-select | ||
- [Guidance](https://design-patterns.service.justice.gov.uk/components/table-multi-select) | ||
- [Guidance](https://design-patterns.service.justice.gov.uk/components/multi-select/) |
{ | ||
"name": "@ministryofjustice/frontend", | ||
"description": "The MOJ Frontend contains the code you need to start building user interfaces for UK Ministry of Justice government services.", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"main": "moj/all.js", | ||
@@ -6,0 +6,0 @@ "sass": "moj/all.scss", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
980880
229239
187
13846
1