Skip to content

Commit 9862cec

Browse files
authored
chore: sync with main
chore: sync with main
2 parents 2586fb2 + b18e5a9 commit 9862cec

File tree

7 files changed

+77
-38
lines changed

7 files changed

+77
-38
lines changed

.github/workflows/release.yml

+18
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,24 @@ jobs:
6464
needs: [finalize-release]
6565
runs-on: ubuntu-latest
6666
steps:
67+
- uses: actions/checkout@v4
68+
# Pull the latest version of the reference
69+
# branch instead of the revision that triggered
70+
# the workflow otherwise we won't get the commit
71+
# created in the previous job and this next job
72+
# will fail.
73+
with:
74+
ref: ${{ github.ref }}
75+
- name: Configure Identity
76+
# Commits from github-actions do not
77+
# trigger other GitHub Actions. As a result,
78+
# we push from Ionitron instead so actions
79+
# run when merging the release branch
80+
# back into main.
81+
run: |
82+
git config user.name ionitron
83+
git config user.email [email protected]
84+
shell: bash
6785
# Lerna does not automatically bump versions
6886
# of Ionicons dependencies that have changed,
6987
# so we do that here.

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [7.2.3](https://github.com/ionic-team/ionicons/compare/v7.2.2...v7.2.3) (2024-03-20)
7+
8+
9+
### Bug Fixes
10+
11+
* **icon:** icon names with numbers are correctly converted to kebab case ([#1339](https://github.com/ionic-team/ionicons/issues/1339)) ([077168d](https://github.com/ionic-team/ionicons/commit/077168dac9347f25d2b8ce440bd0a3e8576f4cdf)), closes [#1338](https://github.com/ionic-team/ionicons/issues/1338)
12+
13+
14+
15+
16+
617
## [7.2.2](https://github.com/ionic-team/ionicons/compare/v7.2.1...v7.2.2) (2023-12-13)
718

819

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"packages": [
33
"./"
44
],
5-
"version": "7.2.2"
5+
"version": "7.2.3"
66
}

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ionicons",
3-
"version": "7.2.2",
3+
"version": "7.2.3",
44
"description": "Premium icons for Ionic.",
55
"files": [
66
"components/",

src/components/icon/test/utils.spec.ts

+39-29
Original file line numberDiff line numberDiff line change
@@ -86,78 +86,88 @@ describe('getName', () => {
8686
describe('addIcons', () => {
8787
it('should add an svg to the icon cache', () => {
8888
const testData = 'stubbed data';
89-
89+
9090
expect(getIconMap().get('logo-ionic')).toEqual(undefined);
91-
91+
9292
addIcons({ 'logo-ionic': 'stubbed data' });
93-
93+
9494
expect(getIconMap().get('logo-ionic')).toEqual(testData);
9595
});
96-
96+
9797
it('should add kebab and camel case names to the icon cache', () => {
9898
const logoIonitron = 'stubbed data';
99-
99+
100100
expect(getIconMap().get('logo-ionitron')).toEqual(undefined);
101101
expect(getIconMap().get('logoIonitron')).toEqual(undefined);
102-
102+
103103
addIcons({ logoIonitron });
104-
104+
105105
expect(getIconMap().get('logo-ionitron')).toEqual(logoIonitron);
106106
expect(getIconMap().get('logoIonitron')).toEqual(logoIonitron);
107+
108+
const logoIonitron0 = 'stubbed data 0'
109+
110+
expect(getIconMap().get('logo-ionitron-0')).toEqual(undefined);
111+
expect(getIconMap().get('logoIonitron0')).toEqual(undefined);
112+
113+
addIcons({ logoIonitron0 });
114+
115+
expect(getIconMap().get('logo-ionitron-0')).toEqual(logoIonitron0);
116+
expect(getIconMap().get('logoIonitron0')).toEqual(logoIonitron0);
107117
});
108-
118+
109119
it('should map to a name that does not match the svg', () => {
110120
const logoIonitron = 'stubbed data';
111-
121+
112122
expect(getIconMap().get('my-fun-icon')).toEqual(undefined);
113-
123+
114124
addIcons({ 'my-fun-icon': logoIonitron });
115-
125+
116126
expect(getIconMap().get('my-fun-icon')).toEqual(logoIonitron);
117127
});
118-
128+
119129
it('should map to an explicit camel case name', () => {
120130
const logoIonitron = 'stubbed data';
121-
131+
122132
expect(getIconMap().get('myCoolIcon')).toEqual(undefined);
123-
133+
124134
addIcons({ 'myCoolIcon': logoIonitron });
125-
135+
126136
expect(getIconMap().get('myCoolIcon')).toEqual(logoIonitron);
127137
});
128-
138+
129139
it('should not warn when mapping the same icon twice', () => {
130140
const spy = jest.spyOn(console, 'warn');
131141

132142
const myIcon = 'my-icon';
133-
143+
134144
expect(spy).not.toHaveBeenCalled();
135-
145+
136146
addIcons({ myIcon });
137-
147+
138148
expect(spy).not.toHaveBeenCalled();
139-
149+
140150
addIcons({ myIcon });
141-
151+
142152
expect(spy).not.toHaveBeenCalled();
143153
});
144-
154+
145155
it('should not overwrite icons', () => {
146156
const spy = jest.spyOn(console, 'warn');
147-
157+
148158
const logoA = 'logo a';
149159
const logoB = 'logo b';
150-
160+
151161
expect(spy).not.toHaveBeenCalled();
152-
162+
153163
expect(getIconMap().get('logo-a')).toEqual(undefined);
154-
164+
155165
addIcons({ 'logo-a': logoB, logoA });
156-
166+
157167
expect(getIconMap().get('logo-a')).toEqual(logoB);
158168
expect(getIconMap().get('logoA')).toEqual(logoA);
159-
169+
160170
expect(spy).toHaveBeenCalled();
161171
});
162-
172+
163173
});

src/components/icon/utils.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export const getIconMap = (): Map<string, string> => {
1818
};
1919

2020
export const addIcons = (icons: { [name: string]: string; }) => {
21-
Object.keys(icons).forEach(name => {
21+
Object.keys(icons).forEach(name => {
2222
addToIconMap(name, icons[name]);
23-
23+
2424
/**
2525
* Developers can also pass in the SVG object directly
2626
* and Ionicons can map the object to a kebab case name.
@@ -31,7 +31,7 @@ export const addIcons = (icons: { [name: string]: string; }) => {
3131
* Using name="addCircleOutline" is valid too, but the
3232
* kebab case naming is preferred.
3333
*/
34-
const toKebabCase = name.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
34+
const toKebabCase = name.replace(/([a-z0-9]|(?=[A-Z]))([A-Z0-9])/g, "$1-$2").toLowerCase();
3535
if (name !== toKebabCase) {
3636
addToIconMap(toKebabCase, icons[name]);
3737
}
@@ -40,12 +40,12 @@ export const addIcons = (icons: { [name: string]: string; }) => {
4040

4141
const addToIconMap = (name: string, data: any) => {
4242
const map = getIconMap();
43-
43+
4444
const existingIcon = map.get(name);
4545

4646
if (existingIcon === undefined) {
4747
map.set(name, data);
48-
48+
4949
/**
5050
* Importing and defining the same icon reference
5151
* multiple times should not yield a warning.

0 commit comments

Comments
 (0)