Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Allow for multiple classes #1842

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1932ea5
sky-icon component
Jul 13, 2018
2c37daa
finishing up component
Jul 16, 2018
534682e
created demo for sky-icon component
Jul 16, 2018
4792244
added imports and exports to core, demo, and index
Jul 16, 2018
9b898bf
Added the visual test
Jul 16, 2018
b58160d
Fixing unit tests
Jul 16, 2018
57eeff6
Fixing TSLint issues
Jul 17, 2018
581ddcb
Fixed visual test
Jul 17, 2018
752c8cb
updating visual test
Jul 17, 2018
26a7c87
fixing TSLint errors
Jul 17, 2018
16cd7aa
fdescribe to describe
Jul 17, 2018
0d3384e
Merge branch 'master' into sky-icon
HJain01 Jul 17, 2018
7561296
fixing merge
Jul 18, 2018
c8abd9a
Merge branch 'master' into sky-icon
Blackbaud-SteveBrush Jul 18, 2018
12eba05
Merged master
Blackbaud-SteveBrush Jul 18, 2018
a2422f9
Fixed missing tile style sheet
Blackbaud-SteveBrush Jul 18, 2018
ac41d78
Updated demo
Blackbaud-SteveBrush Jul 18, 2018
325bfad
Added more icons to visual test
Blackbaud-SteveBrush Jul 18, 2018
3072ee8
Merge branch 'master' into contrib-sky-icon
Blackbaud-SteveBrush Jul 18, 2018
cdecb5a
Allow for multiple classes
Jul 19, 2018
55fde1a
Merge branch 'master' into sky-icon-edits
HJain01 Jul 19, 2018
beec5db
Fixed unit test
Jul 19, 2018
f7a497f
Merge branch 'sky-icon-edits' of https://github.com/Remulus2006/skyux…
Jul 19, 2018
1f2b52f
Added unit test to check for optional fixedWidth
Jul 19, 2018
7ea881c
Checks to see how many classes there are
Jul 19, 2018
257b8e4
fdescribe to describe
Jul 19, 2018
da17078
Fixed PR suggestions
Jul 19, 2018
2fbcc76
changed to alphabetical order and got rid of an f
Jul 20, 2018
39ed79c
Moved angled bracket
Jul 20, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 32 additions & 11 deletions skyux-spa-visual-tests/src/app/icon/icon-visual.component.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
<div id="screenshot-icon">
<sky-icon icon="circle"></sky-icon>
<sky-icon icon="trash"></sky-icon>
<sky-icon icon="bars"></sky-icon>
<sky-icon icon="cog"></sky-icon>
<sky-icon icon="database"></sky-icon>
<sky-icon icon="users"></sky-icon>
<sky-icon icon="user"></sky-icon>
<sky-icon icon="comment"></sky-icon>
<sky-icon icon="chevron-down"></sky-icon>
<sky-icon icon="chevron-up"></sky-icon>
<div
id="screenshot-icon">
<sky-icon
icon="circle">
</sky-icon>
<sky-icon
icon="trash">
</sky-icon>
<sky-icon
icon="bars">
</sky-icon>
<sky-icon
icon="cog">
</sky-icon>
<sky-icon
icon="database">
</sky-icon>
<sky-icon
icon="users">
</sky-icon>
<sky-icon
icon="user">
</sky-icon>
<sky-icon
icon="comment">
</sky-icon>
<sky-icon
icon="chevron-down">
</sky-icon>
<sky-icon
icon="chevron-up">
</sky-icon>
</div>
51 changes: 41 additions & 10 deletions src/demos/icon/icon-demo.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
<sky-icon icon="spinner" size="3x" fixedWidth="true"></sky-icon>
<sky-icon icon="trash" size="sm"></sky-icon>
<sky-icon icon="bars" size="lg"></sky-icon>
<sky-icon icon="cog" size="2x"></sky-icon>
<sky-icon icon="database" size="3x"></sky-icon>
<sky-icon icon="users" size="4x"></sky-icon>
<sky-icon icon="user" size="5x"></sky-icon>
<sky-icon icon="comment" size="xs"></sky-icon>
<sky-icon icon="chevron-down" size="sm"></sky-icon>
<sky-icon icon="chevron-up" size="5x"></sky-icon>
<sky-icon
icon="bars"
size="lg">
</sky-icon>
<sky-icon
icon="chevron-down"
size="sm">
</sky-icon>
<sky-icon
icon="chevron-up"
size="5x">
</sky-icon>
<sky-icon
icon="cog"
size="2x">
</sky-icon>
<sky-icon
icon="comment"
size="xs">
</sky-icon>
<sky-icon
icon="database"
size="3x">
</sky-icon>
<sky-icon
icon="spinner"
size="3x"
fixedWidth="true">
</sky-icon>
<sky-icon
icon="trash"
size="sm">
</sky-icon>
<sky-icon
icon="users"
size="4x">
</sky-icon>
<sky-icon
icon="user"
size="5x">
</sky-icon>
6 changes: 5 additions & 1 deletion src/modules/icon/fixtures/icon.component.fixture.html
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<sky-icon [icon]="icon" [size]="size" [fixedWidth]="fixedWidth"></sky-icon>
<sky-icon
[icon]="icon"
[size]="size"
[fixedWidth]="fixedWidth">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alphabetical
<sky-icon
[fixedWidth]="fixedWidth"
[icon]="icon"
[size]="size">

</sky-icon>
3 changes: 2 additions & 1 deletion src/modules/icon/icon.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<i *ngIf="icon"
<i
*ngIf="icon"
aria-hidden="true"
class="fa sky-icon"
[ngClass]="classList()"
Expand Down
18 changes: 14 additions & 4 deletions src/modules/icon/icon.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
expect
} from '@blackbaud/skyux-builder/runtime/testing/browser';

describe('Icon component', () => {
fdescribe('Icon component', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed an "f" 😉

let fixture: ComponentFixture<IconTestComponent>;
let cmp: IconTestComponent;
let element: HTMLElement;
Expand Down Expand Up @@ -44,15 +44,25 @@ describe('Icon component', () => {
expect(element.querySelector('.sky-icon').classList.length).toBe(4);
});

it('should display something other than circle', () => {
it('should display a different icon with a different size and a fixedWidth', () => {
cmp.icon = 'broom';
cmp.size = '';
cmp.size = '5x';
cmp.fixedWidth = true;
fixture.detectChanges();
expect(cmp.icon).toBe('broom');
expect(element.querySelector('.sky-icon')).toHaveCssClass('fa-broom');
expect(element.querySelector('.sky-icon')).toHaveCssClass('fa-5x');
expect(element.querySelector('.sky-icon')).toHaveCssClass('fa-fw');
expect(element.querySelector('.sky-icon').classList.length).toBe(4);
expect(element.querySelector('.sky-icon').classList.length).toBe(5);
expect(element.querySelector('.sky-icon').getAttribute('aria-hidden')).toBe('true');
});

it('should show an icon without optional inputs', () => {
cmp.icon = 'spinner';
cmp.size = undefined;
cmp.fixedWidth = undefined;
fixture.detectChanges();
expect(element.querySelector('.sky-icon')).toHaveCssClass('fa-spinner');
expect(element.querySelector('.sky-icon').classList.length).toBe(3);
});
});
6 changes: 3 additions & 3 deletions src/modules/icon/icon.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export class SkyIconComponent {
public size: string;

@Input()
public fixedWidth: boolean = true;
public fixedWidth: boolean;

public classList(): string[] {
let list: string[] = [];
list.push('fa-' + this.icon);
if (this.size !== '') {
if (this.size) {
list.push('fa-' + this.size);
}
if (this.fixedWidth === true) {
if (this.fixedWidth) {
list.push('fa-fw');
}
return list;
Expand Down