Skip to content

Commit b526fa5

Browse files
authored
Merge pull request #563 from materializecss/v2-dev
Release v2.2.1
2 parents 0718493 + 65ddf18 commit b526fa5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1427
-1268
lines changed

.github/workflows/nightly.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@master
1414

15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 23
18+
1519
- name: Run tests
1620
run: |
1721
npm i

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default [
1616
'@typescript-eslint/no-unused-vars': 'error',
1717
'@typescript-eslint/no-unused-expressions': 'error',
1818
'@typescript-eslint/no-this-alias': 'warn',
19-
'@typescript-eslint/no-empty-object-type': 'error',
19+
'@typescript-eslint/no-empty-object-type': ['error' , { allowWithName: 'BaseOptions$' }],
2020
'@typescript-eslint/no-require-imports': 'error',
2121
'@typescript-eslint/no-unsafe-function-type': 'error'
2222
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "The responsive front-end library based on Material Design from Google.",
44
"author": "The Materialize Team",
55
"homepage": "https://materializeweb.com",
6-
"version": "2.2.0",
6+
"version": "2.2.1",
77
"style": "dist/css/materialize.css",
88
"sass": "sass/materialize.scss",
99
"typings": "dist/js/materialize.d.ts",
@@ -37,7 +37,7 @@
3737
"build": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
3838
"release": "npm run lint && npm run build && node ci/compress.js",
3939
"preversion": "npm run lint && npm test",
40-
"version": "npm run build && node ci/compress.js && git add -A dist src/index.ts"
40+
"version": "npm run build && node ci/compress.js && git add ."
4141
},
4242
"lint-staged": {
4343
"js/*.js": [
@@ -71,7 +71,8 @@
7171
"typescript-eslint": "^8.6.0"
7272
},
7373
"files": [
74-
"dist",
74+
"dist/css",
75+
"dist/js",
7576
"sass/**/*.scss",
7677
"LICENSE"
7778
]

spec/helpers/helper.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* eslint-disable no-undef */
2-
/* eslint-disable no-unused-vars */
3-
41
const KEYMAP = {
52
'27': 'Escape',
63
'32': 'Space',
@@ -121,28 +118,27 @@ const KEYMAP = {
121118
'105': '9'
122119
};
123120

121+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
124122
function XloadHtml(html, options) {
125123
options = options ? options : {};
126124
const defaultOptions = { insertionType: 'append' };
127125
options = {
128126
...defaultOptions,
129127
...options
130128
};
131-
132129
const div = document.createElement('div');
133130
div.classList.add('please-delete-me');
134131
div.innerHTML = html;
135-
136132
if (options.insertionType === 'append') {
137133
document.body.appendChild(div);
138134
} else if (options.insertionType === 'prepend') {
139135
document.body.prepend(div);
140136
}
141137
}
142138

139+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
143140
function XunloadFixtures() {
144141
document.querySelectorAll('.please-delete-me').forEach((el) => el.remove());
145-
//
146142
document.querySelectorAll('.material-tooltip').forEach((el) => el.remove());
147143
document.querySelectorAll('.dropdown-content').forEach((el) => el.remove());
148144
}
@@ -152,7 +148,7 @@ beforeEach(() => {
152148
toExist: (util, customEqualityTesters) => {
153149
return {
154150
compare: (actual) => {
155-
let result = {};
151+
const result = {};
156152
result.pass = util.equals(!!actual, true, customEqualityTesters);
157153
return result;
158154
}
@@ -190,7 +186,7 @@ beforeEach(() => {
190186
return {
191187
compare: (actual) => {
192188
const style = getComputedStyle(actual);
193-
let result = {};
189+
const result = {};
194190
result.pass = util.equals(
195191
style.getPropertyValue('display'),
196192
'none',
@@ -204,7 +200,7 @@ beforeEach(() => {
204200
return {
205201
compare: (actual) => {
206202
const style = getComputedStyle(actual);
207-
let result = {};
203+
const result = {};
208204
result.pass = !util.equals(
209205
style.getPropertyValue('display'),
210206
'none',
@@ -224,7 +220,7 @@ beforeEach(() => {
224220
toHaveClass: (util, customEqualityTesters) => {
225221
return {
226222
compare: (actual, expected) => {
227-
let result = {};
223+
const result = {};
228224
result.pass = util.equals(
229225
actual.classList.contains(expected),
230226
true,
@@ -237,7 +233,7 @@ beforeEach(() => {
237233
toNotHaveClass: (util, customEqualityTesters) => {
238234
return {
239235
compare: function (actual, expected) {
240-
let result = {};
236+
const result = {};
241237
result.pass = util.equals(
242238
actual.classList.contains(expected),
243239
false,

spec/tests/autocomplete/autocompleteSpec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('Autocomplete Plugin', () => {
9696
}
9797
const limitedInstance = M.Autocomplete.getInstance(limited);
9898
const limit = 20;
99-
limitedInstance.options.onSearch = (text) => {
99+
limitedInstance.options.onSearch = () => {
100100
const filteredItems = data.slice(0, limit);
101101
limitedInstance.setMenuItems(filteredItems);
102102
};
@@ -114,8 +114,8 @@ describe('Autocomplete Plugin', () => {
114114
});
115115

116116
it('should open correctly from typing', (done) => {
117-
let normal = document.querySelector('#normal-autocomplete');
118-
let autocompleteEl = normal.parentNode.querySelector('.autocomplete-content');
117+
const normal = document.querySelector('#normal-autocomplete');
118+
const autocompleteEl = normal.parentNode.querySelector('.autocomplete-content');
119119
focus(normal);
120120
normal.value = 'e';
121121
keyup(normal, 69);
@@ -129,8 +129,8 @@ describe('Autocomplete Plugin', () => {
129129
});
130130

131131
it('should open correctly from keyboard focus', (done) => {
132-
let normal = document.querySelector('#normal-autocomplete');
133-
let autocompleteEl = normal.parentNode.querySelector('.autocomplete-content');
132+
const normal = document.querySelector('#normal-autocomplete');
133+
const autocompleteEl = normal.parentNode.querySelector('.autocomplete-content');
134134
normal.value = 'e';
135135
keyup(normal, 9);
136136
focus(normal);

spec/tests/cards/cardsSpec.js

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable no-undef */
2-
31
describe('Cards', () => {
42
const fixture = `<div class="row">
53
<div class="col s12 m6">
@@ -91,13 +89,13 @@ describe('Cards', () => {
9189

9290
beforeEach(() => {
9391
revealCard = document.querySelector('.card.reveal');
92+
M.Cards.init(document.querySelectorAll('.card'));
9493
});
9594

9695
it('should have a hidden card-reveal', (done) => {
9796
const revealDiv = revealCard.querySelector('.card-reveal');
9897
const activator = revealCard.querySelector('.activator');
9998
expect(revealDiv).toBeHidden('reveal div should be hidden initially');
100-
10199
click(activator);
102100
setTimeout(() => {
103101
expect(revealDiv).toBeVisible('reveal did not appear after activator was clicked.');
@@ -150,13 +148,13 @@ describe('Cards', () => {
150148
});
151149

152150
it('should have small card dimensions', () => {
153-
let cardImage = small.querySelector('.card-image');
154-
let cardContent = small.querySelector('.card-content');
155-
let cardAction = small.querySelector('.card-action');
156-
let smallRect = small.getBoundingClientRect();
157-
let cardImageRect = cardImage.getBoundingClientRect();
158-
let cardContentRect = cardContent.getBoundingClientRect();
159-
let cardActionRect = cardAction.getBoundingClientRect();
151+
const cardImage = small.querySelector('.card-image');
152+
const cardContent = small.querySelector('.card-content');
153+
const cardAction = small.querySelector('.card-action');
154+
const smallRect = small.getBoundingClientRect();
155+
const cardImageRect = cardImage.getBoundingClientRect();
156+
const cardContentRect = cardContent.getBoundingClientRect();
157+
const cardActionRect = cardAction.getBoundingClientRect();
160158

161159
expect(smallRect.height).toEqual(300, 'small card should be 300px high');
162160
expect(cardImageRect.height).toBeLessThan(181, 'small image should be <= 180px or 60% high');
@@ -171,13 +169,13 @@ describe('Cards', () => {
171169
});
172170

173171
it('should have medium card dimensions', () => {
174-
let cardImage = medium.querySelector('.card-image');
175-
let cardContent = medium.querySelector('.card-content');
176-
let cardAction = medium.querySelector('.card-action');
177-
let mediumRect = medium.getBoundingClientRect();
178-
let cardImageRect = cardImage.getBoundingClientRect();
179-
let cardContentRect = cardContent.getBoundingClientRect();
180-
let cardActionRect = cardAction.getBoundingClientRect();
172+
const cardImage = medium.querySelector('.card-image');
173+
const cardContent = medium.querySelector('.card-content');
174+
const cardAction = medium.querySelector('.card-action');
175+
const mediumRect = medium.getBoundingClientRect();
176+
const cardImageRect = cardImage.getBoundingClientRect();
177+
const cardContentRect = cardContent.getBoundingClientRect();
178+
const cardActionRect = cardAction.getBoundingClientRect();
181179

182180
expect(mediumRect.height).toEqual(400, 'medium card should be 400px high');
183181
expect(cardImageRect.height).toBeLessThan(241, 'medium image should be <= 240 or 60% high');
@@ -192,13 +190,13 @@ describe('Cards', () => {
192190
});
193191

194192
it('should have large card dimensions', () => {
195-
let cardImage = large.querySelector('.card-image');
196-
let cardContent = large.querySelector('.card-content');
197-
let cardAction = large.querySelector('.card-action');
198-
let largeRect = large.getBoundingClientRect();
199-
let cardImageRect = cardImage.getBoundingClientRect();
200-
let cardContentRect = cardContent.getBoundingClientRect();
201-
let cardActionRect = cardAction.getBoundingClientRect();
193+
const cardImage = large.querySelector('.card-image');
194+
const cardContent = large.querySelector('.card-content');
195+
const cardAction = large.querySelector('.card-action');
196+
const largeRect = large.getBoundingClientRect();
197+
const cardImageRect = cardImage.getBoundingClientRect();
198+
const cardContentRect = cardContent.getBoundingClientRect();
199+
const cardActionRect = cardAction.getBoundingClientRect();
202200

203201
expect(largeRect.height).toEqual(500, 'large card should be 500px high');
204202
expect(cardImageRect.height).toBeLessThan(301, 'large image should be <= 300 or 60% high');

spec/tests/carousel/carouselSpec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable no-undef */
2-
31
describe('Carousel', () => {
42
const fixture = `<div class="carousel carousel-slider" id="slider-no-wrap">
53
<div class="carousel-item">
@@ -52,10 +50,12 @@ describe('Carousel', () => {
5250

5351
document.querySelectorAll('.indicator-item')[1].click();
5452
setTimeout(() => {
55-
expect(carousel.center).toEqual(1, 'carousel item was not visible after indicator interaction');
53+
expect(carousel.center).toEqual(
54+
1,
55+
'carousel item was not visible after indicator interaction'
56+
);
5657
done();
5758
}, 30);
5859
});
59-
6060
});
6161
});

spec/tests/chips/chipsSpec.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable no-undef */
2-
31
describe('Chips', () => {
42
const fixture = `<div class="chips"></div>
53
<div class="chips chips-initial"></div>
@@ -66,7 +64,7 @@ describe('Chips', () => {
6664
M.Chips.init(chips);
6765
M.Chips.init(chips);
6866
chipsUserInput = document.querySelector('.chips.input-field');
69-
M.Chips.init(chips, {allowUserInput: true});
67+
M.Chips.init(chips, { allowUserInput: true });
7068
input = chipsUserInput.querySelectorAll('input');
7169
expect(input.length).toEqual(1, 'Should dynamically generate chips structure.');
7270
});
@@ -77,8 +75,8 @@ describe('Chips', () => {
7775
input.value = 'one';
7876
keydown(input, 13);
7977
setTimeout(() => {
80-
let numChips = chips.querySelectorAll('.chip').length;
81-
let oneChip = chips.querySelector('.chip');
78+
const numChips = chips.querySelectorAll('.chip').length;
79+
const oneChip = chips.querySelector('.chip');
8280
expect(numChips).toEqual(1, 'one chip should have been added');
8381
for (let i = oneChip.children.length - 1; i >= 0; i--) {
8482
oneChip.children[i].remove();
@@ -92,7 +90,7 @@ describe('Chips', () => {
9290
chips = document.querySelector('.chips.chips-initial.input-field');
9391
let numChips = chips.querySelectorAll('.chip').length;
9492
expect(numChips).toEqual(3, '3 initial chips should have been added');
95-
let chipCloseButton = chips.querySelectorAll('.chip .close');
93+
const chipCloseButton = chips.querySelectorAll('.chip .close');
9694
expect(chipCloseButton.length).toEqual(3, 'expected all chips to have close button');
9795
click(chipCloseButton[0]);
9896
setTimeout(() => {

0 commit comments

Comments
 (0)