Skip to content

Commit

Permalink
maint(pat structure): fixing structure tests
Browse files Browse the repository at this point in the history
  • Loading branch information
petschki committed Feb 9, 2023
1 parent b81c1b5 commit 2b233c0
Show file tree
Hide file tree
Showing 9 changed files with 1,402 additions and 3,403 deletions.
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ const path = require("path");
const config = require("@patternslib/dev/jest.config.js");

config.setupFilesAfterEnv.push(path.resolve(__dirname, "./src/setup-tests.js"));
config.transformIgnorePatterns = [
"/node_modules/(?!@patternslib/)(?!@plone/)(?!preact/)(?!screenfull/)(?!bootstrap/)(?!datatable/)(?!regenerator-runtime/).+\\.[t|j]sx?$",
];

module.exports = config;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@11ty/eleventy": "^1.0.2",
"@11ty/eleventy-navigation": "^0.3.5",
"@11ty/eleventy-plugin-syntaxhighlight": "^4.2.0",
"@patternslib/dev": "^3.1.8",
"@patternslib/dev": "^3.1.9",
"@types/sinon": "^10.0.13",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion src/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ var storage = {
},
};

const ICON_CACHE = new Map();
export const ICON_CACHE = new Map();

/**
* Return a <svg> element from a icon name.
Expand Down
3 changes: 1 addition & 2 deletions src/pat/datatables/datatables.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import $ from "jquery";
import "regenerator-runtime/runtime"; // needed for ``await`` support
import Base from "@patternslib/patternslib/src/core/base";

Expand Down Expand Up @@ -39,6 +38,6 @@ export default Base.extend({
await import("datatables.net-select");
//await import("datatables.net-select-bs5");

$(this.el).DataTable(this.options);
this.$el.DataTable(this.options);
},
});
1 change: 0 additions & 1 deletion src/pat/structure/js/actions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import $ from "jquery";
import _t from "../../../core/i18n-wrapper";
import utils from "../../../core/utils";
import Backbone from "backbone";
Expand Down
17 changes: 7 additions & 10 deletions src/pat/structure/js/collections/result.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import $ from "jquery";
import Backbone from "backbone";
import Result from "../models/result";
import utils from "../../../../core/utils";
Expand All @@ -13,11 +12,10 @@ export default Backbone.PageableCollection.extend({
this.view = options.view;
this.url = options.url;

this.queryHelper = utils.QueryHelper(
$.extend(true, {}, this.view.options, {
attributes: this.view.options.queryHelperAttributes,
})
);
this.queryHelper = utils.QueryHelper({
attributes: this.view.options.queryHelperAttributes,
...this.view.options
});

this.queryParser = function (options) {
if (options === undefined) {
Expand All @@ -29,11 +27,10 @@ export default Backbone.PageableCollection.extend({

return JSON.stringify({
criteria: this.queryHelper.getCriterias(
term,
$.extend({}, options, {
term, {
additionalCriterias: this.view.additionalCriterias,
})
),
...options,
}),
sort_on: sortOn,
sort_order: sortOrder,
});
Expand Down
7 changes: 2 additions & 5 deletions src/pat/structure/js/views/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ export default BaseView.extend({
"last_comment_date",
];

self.translatableColumns = [
"review_state",
];
self.translatableColumns = ["review_state"];
},

events: {
Expand All @@ -63,7 +61,7 @@ export default BaseView.extend({
setContextInfo: function () {
const data = this.contextInfo;
/* set breadcrumb title info */
const crumbs = data.breadcrumbs;
const crumbs = data && data.breadcrumbs;
if (crumbs && crumbs.length) {
const $crumbs = this.$(".fc-breadcrumbs a.crumb");
_.each(crumbs, (crumb, idx) => {
Expand All @@ -77,7 +75,6 @@ export default BaseView.extend({
// By default do not start sorted by any column
// Ignore first column and the last one (activeColumns.length + 1)
// Do not show paginator, search or information, we only want column sorting

const datatables_options = {
order: [0, "asc"],
columnDefs: [
Expand Down
Loading

0 comments on commit 2b233c0

Please sign in to comment.