diff --git a/src/templates/bootstrap5/iconClass.spec.ts b/src/templates/bootstrap5/iconClass.spec.ts new file mode 100644 index 000000000..4f333539b --- /dev/null +++ b/src/templates/bootstrap5/iconClass.spec.ts @@ -0,0 +1,8 @@ +import iconClass from './iconClass'; +import {expect} from 'chai'; +describe('iconClass', () => { + it('should output bootstrap icon classes if iconset is bi', () => { + const classOutput = iconClass('bi', 'remove', false); + expect(classOutput).to.equal('bi bi-trash') + }); +}); diff --git a/src/templates/bootstrap5/iconClass.ts b/src/templates/bootstrap5/iconClass.ts index fb5bade35..7227cc9fb 100644 --- a/src/templates/bootstrap5/iconClass.ts +++ b/src/templates/bootstrap5/iconClass.ts @@ -1,4 +1,6 @@ -export default (iconset, name, spinning) => { +type iconset = 'bi' | 'fa'; + +export default (iconset: iconset, name: string, spinning: boolean) => { let biName = name; switch (name) { case 'cog': @@ -164,5 +166,5 @@ export default (iconset, name, spinning) => { biName = 'arrow-clockwise'; break; } - return spinning ? 'spinner-border spinner-border-sm' : `${iconset} ${iconset}-${biName}`; + return spinning ? 'spinner-border spinner-border-sm' : `${iconset} ${iconset}-${iconset === 'bi' ? biName : name}`; }; diff --git a/src/test.spec.ts b/src/test.spec.ts index 4b5b563c2..536849ded 100644 --- a/src/test.spec.ts +++ b/src/test.spec.ts @@ -1,6 +1,6 @@ describe('First Test', () => { it('Runs tests', (done) => { done(); - }) + }); });