Skip to content

Commit d70744c

Browse files
FIO-10065: changed name to biname when using bootstrap icons (#126)
* changed name to biname when using bootstrap icons * added test
1 parent 52b8e21 commit d70744c

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import iconClass from './iconClass';
2+
import {expect} from 'chai';
3+
describe('iconClass', () => {
4+
it('should output bootstrap icon classes if iconset is bi', () => {
5+
const classOutput = iconClass('bi', 'remove', false);
6+
expect(classOutput).to.equal('bi bi-trash')
7+
});
8+
});

src/templates/bootstrap5/iconClass.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export default (iconset, name, spinning) => {
1+
type iconset = 'bi' | 'fa';
2+
3+
export default (iconset: iconset, name: string, spinning: boolean) => {
24
let biName = name;
35
switch (name) {
46
case 'cog':
@@ -164,5 +166,5 @@ export default (iconset, name, spinning) => {
164166
biName = 'arrow-clockwise';
165167
break;
166168
}
167-
return spinning ? 'spinner-border spinner-border-sm' : `${iconset} ${iconset}-${biName}`;
169+
return spinning ? 'spinner-border spinner-border-sm' : `${iconset} ${iconset}-${iconset === 'bi' ? biName : name}`;
168170
};

src/test.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe('First Test', () => {
22
it('Runs tests', (done) => {
33
done();
4-
})
4+
});
55
});
66

0 commit comments

Comments
 (0)