Skip to content

Commit

Permalink
feat: introduce devMode to support nodejs based unit testing (#944)
Browse files Browse the repository at this point in the history
  • Loading branch information
zewa666 authored Dec 6, 2023
1 parent e7bbe3a commit 40d2dc4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions slick.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ if (typeof Slick === "undefined") {
maxSupportedCssHeight: 1000000000,
sanitizer: undefined, // sanitize function, built in basic sanitizer is: Slick.RegexSanitizer(dirtyHtml)
logSanitizedHtml: false, // log to console when sanitised - recommend true for testing of dev and production
shadowRoot: undefined
shadowRoot: undefined,
devMode: false
};

var columnDefaults = {
Expand Down Expand Up @@ -2116,6 +2117,11 @@ if (typeof Slick === "undefined") {
var i;
if (!stylesheet) {
var sheets = (options.shadowRoot || document).styleSheets;

if (options.devMode?.ownerNodeIndex >= 0) {
sheets[options.devMode.ownerNodeIndex].ownerNode = _style;
}

for (i = 0; i < sheets.length; i++) {
if ((sheets[i].ownerNode || sheets[i].owningElement) == _style) {
stylesheet = sheets[i];
Expand Down Expand Up @@ -3765,7 +3771,7 @@ if (typeof Slick === "undefined") {
}

function getViewportWidth() {
viewportW = parseFloat(utils.innerSize(_container, 'width'));
viewportW = parseFloat(utils.innerSize(_container, 'width')) || options.devMode?.containerClientWidth;
}

function resizeCanvas() {
Expand Down

0 comments on commit 40d2dc4

Please sign in to comment.