Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ depends-parser: install


# Unlink any linked dependencies before building a bundle.
bundle-pre:
# Also run parent @patternslib/dev `bundle-pre` (double colon `::`)
bundle-pre::
-$(YARN) unlink @patternslib/dev
-$(YARN) unlink @patternslib/pat-content-mirror
-$(YARN) unlink @patternslib/pat-doclock
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"@fullcalendar/list": "^5.11.3",
"@fullcalendar/luxon2": "^5.11.3",
"@fullcalendar/timegrid": "^5.11.3",
"@stomp/stompjs": "^7.1.1",
"dompurify": "^3.2.6",
"@stomp/stompjs": "^7.3.0",
"dompurify": "^3.4.1",
"highlight.js": "<11",
"imagesloaded": "^4.1.4",
"jquery": "^3.7.1",
"jquery-jcrop": "^0.9.13",
"luxon": "3.6.1",
"luxon": "3.7.2",
"marked": "^15.0.6",
"masonry-layout": "^4.2.2",
"moment": "^2.30.1",
"moment-timezone": "^0.6.0",
"moment-timezone": "^0.6.1",
"photoswipe": "^4.1.3",
"pikaday": "^1.8.0",
"prettier": "^2.8.8",
Expand All @@ -36,14 +36,14 @@
"tippy.js": "^6.3.7"
},
"devDependencies": {
"@patternslib/dev": "^3.8.1",
"@patternslib/dev": "^4.0.0",
"@patternslib/pat-content-mirror": "^4.0.1",
"@patternslib/pat-doclock": "^3.0.0",
"@patternslib/pat-shopping-cart": "^3.0.0",
"@patternslib/pat-sortable-table": "^3.1.0",
"@patternslib/pat-tiptap": "^4.10.1",
"@patternslib/pat-upload": "^3.1.1",
"copy-webpack-plugin": "^13.0.0",
"copy-webpack-plugin": "^14.0.0",
"css.escape": "^1.5.1",
"modernizr": "^3.13.1",
"pegjs": "0.11.0-master.b7b87ea"
Expand Down
2 changes: 1 addition & 1 deletion src/core/base.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe("pat-base: The Base class for patterns", function () {
});

it("requires that patterns that extend it provide an object of properties", function () {
expect(Base.extend).toThrowError(
expect(Base.extend).toThrow(
"Pattern configuration properties required when calling Base.extend"
);
});
Expand Down
4 changes: 2 additions & 2 deletions src/core/mockup-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const parser = {
options = this.getOptions(el.parentElement, pattern_name, options);
}
// collect all options from element
let el_options = {};
let el_options;
// Use `getAttribute` over `dataset` because dataset uses camelCasing of data attributes.
el_options = el.getAttribute(`data-pat-${pattern_name}`);
if (el_options) {
Expand All @@ -47,7 +47,7 @@ const parser = {
}
return {
...options,
...el_options,
...(el_options || {}),
};
},
};
Expand Down
11 changes: 7 additions & 4 deletions src/core/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,16 @@ class ArgumentParser {
flag = part;
}
if (flag in this.parameters && this.parameters[flag].type === "boolean") {
positional = false;
positional = false; // eslint-disable-line no-useless-assignment
this._set(opts, flag, sense);
} else if (flag in this.enum_values) {
positional = false;
positional = false; // eslint-disable-line no-useless-assignment
this._set(opts, this.enum_values[flag], flag);
} else if (positional) this._set(opts, this.order[i], part);
else {
} else if (positional) {
// TODO: This branch is always executed, the next else clause will never.
// eslint complains about no-useless-assignment for `positional`.
this._set(opts, this.order[i], part);
} else {
parts.unshift(part);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ while ((match = disable_re.exec(window.location.search)) !== null) {
log.info("Pattern disabled via url config:", match[1]);
}

while ((match = dont_catch_re.exec(window.location.search)) !== null) {
while (dont_catch_re.exec(window.location.search) !== null) {
dont_catch = true;
log.info("I will not catch init exceptions");
}
Expand Down
18 changes: 9 additions & 9 deletions src/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,12 @@ function addURLQueryParameter(fullURL, param, value) {
*
* Taken from http://stackoverflow.com/questions/7640270/adding-modify-query-string-get-variables-in-a-url-with-javascript
*/
var val = new RegExp("(\\?|\\&)" + param + "=.*?(?=(&|$))"),
parts = fullURL.toString().split("#"),
url = parts[0],
hash = parts[1],
qstring = /\?.+$/,
newURL = url;
const val = new RegExp("(\\?|\\&)" + param + "=.*?(?=(&|$))");
const parts = fullURL.toString().split("#");
const url = parts[0];
const hash = parts[1];
const qstring = /\?.+$/;
let newURL;
// Check if the parameter exists
if (val.test(url)) {
// if it does, replace it, using the captured group
Expand Down Expand Up @@ -415,7 +415,7 @@ function isElementInViewport(el, partial = false, offset = 0) {
rec.top >= 0 &&
rec.left >= 0 &&
rec.bottom <=
(window.innerHeight || document.documentElement.clientHeight) &&
(window.innerHeight || document.documentElement.clientHeight) &&
rec.right <= (window.innerWidth || document.documentElement.clientWidth)
);
}
Expand Down Expand Up @@ -530,7 +530,7 @@ function checkInputSupport(type, invalid_value) {
/* Check input type support.
* See: https://stackoverflow.com/a/10199306/1337474
*/
let support = false;
let support;
const input = document.createElement("input");
input.setAttribute("type", type);
support = input.type == type;
Expand Down Expand Up @@ -613,7 +613,7 @@ const isIE = () => {
// See: https://stackoverflow.com/a/9851769/1337474
// Internet Explorer 6-11
// eslint-disable-next-line no-constant-binary-expression
return /*@cc_on!@*/false || !!document.documentMode;
return /*@cc_on!@*/ false || !!document.documentMode;
};

const jqToNode = (el) => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/depends_parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("Depedency expression parser", function () {
it("Can not do order comparison to string", function () {
expect(function () {
parser.parse("foo<bar");
}).toThrowError('Expected number or whitespace but "b" found.');
}).toThrow('Expected number or whitespace but "b" found.');
});

it("Equality comparison with string", function () {
Expand Down
39 changes: 18 additions & 21 deletions src/pat/calendar/calendar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,31 +176,30 @@ describe("1 - Calendar tests", () => {
await utils.timeout(1); // wait a tick for async to settle.

expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
el.querySelector(".view-week").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
el.querySelector(".view-day").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
el.querySelector(".view-month").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
el.querySelector(".jump-next").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
el.querySelector(".jump-prev").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
el.querySelector(".jump-today").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;
});

it("Changes views when clicked", async () => {
Expand Down Expand Up @@ -507,31 +506,30 @@ describe("2 - Calendar tests with calendar controls outside pat-calendar", () =>
await utils.timeout(1); // wait a tick for async to settle.

expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".view-week").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".view-day").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".view-month").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".jump-next").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".jump-prev").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".jump-today").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;
});

it("2.2 - Changes views when clicked", async () => {
Expand Down Expand Up @@ -617,30 +615,29 @@ describe("3 - Calendar tests with calendar controls outside pat-calendar but tit
await utils.timeout(1); // wait a tick for async to settle.

expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".view-week").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".view-day").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".view-month").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".jump-next").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".jump-prev").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;

title = title_el.innerHTML;
document.querySelector(".jump-today").click();
expect(title_el.innerHTML === title).toBeFalsy();
title = title_el.innerHTML;
});
});
2 changes: 1 addition & 1 deletion src/pat/checklist/checklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default Base.extend({
},

find_checkboxes(ref_el, sel) {
let chkbxs = [];
let chkbxs;
if (this.options.select.indexOf("#") === 0) {
chkbxs = this.el.querySelectorAll(sel);
} else {
Expand Down
16 changes: 14 additions & 2 deletions src/pat/gallery/gallery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ describe("pat-gallery", function () {
const instance = new pattern(el);

const spy_init_trigger = jest.spyOn(instance, "initialize_trigger");
const spy_init_gallery = jest.spyOn(instance, "initialize_gallery");

// Create a spy that prevents the actual PhotoSwipe initialization
const spy_init_gallery = jest.spyOn(instance, "initialize_gallery").mockImplementation((e) => {
e.preventDefault();
// Just return without initializing PhotoSwipe
return;
});

await utils.timeout(1);

Expand Down Expand Up @@ -63,7 +69,13 @@ describe("pat-gallery", function () {
const instance = new pattern(el);

const spy_init_trigger = jest.spyOn(instance, "initialize_trigger");
const spy_init_gallery = jest.spyOn(instance, "initialize_gallery");

// Create a spy that prevents the actual PhotoSwipe initialization
const spy_init_gallery = jest.spyOn(instance, "initialize_gallery").mockImplementation((e) => {
e.preventDefault();
// Just return without initializing PhotoSwipe
return;
});

await utils.timeout(1);

Expand Down
Loading
Loading