-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rc] Upgrade dependencies; merge master (#55)
* Bump acorn from 6.4.0 to 6.4.1 (#40) Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](acornjs/acorn@6.4.0...6.4.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Assorted fixes; unit tests (#42) * Updated changelog/package.json for 3.2.0 release (#43) * Adding license (#47) Added license to address blackbaud/skyux2-docs#894 * Fixed href generator for lowercase type names (#49) * Updated changelog/package.json for 3.2.1 release (#50) * Added theme picker control panel to demo (#52) * Added theme picker control panel to demo * Added tests * Added theme switcher to sample page. * Addressed PR feedback * Fixed import paths * Updated CHANGELOG and package.json for 3.3.0 release (#53) * [rc] Upgrade dependencies * Added restricted view * Added to peers * Remove dev bundle Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Denise Pena <Denise.Pena@blackbaud.me> Co-authored-by: Paul Crowder <paul.crowder@blackbaud.com>
- Loading branch information
1 parent
0158443
commit 2c23c47
Showing
23 changed files
with
996 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/app/public/modules/demo/demo-control-panel-theme.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<strong>Theme</strong> | ||
<sky-radio-group | ||
name="theme" | ||
[(ngModel)]="theme" | ||
> | ||
<ul | ||
class="sky-list-unstyled" | ||
> | ||
<li *ngFor="let themeOption of themeOptions"> | ||
<sky-radio | ||
[value]="themeOption.value" | ||
> | ||
<sky-radio-label>{{ themeOption.label }}</sky-radio-label> | ||
</sky-radio> | ||
</li> | ||
</ul> | ||
</sky-radio-group> | ||
|
||
<strong>Mode</strong> | ||
<sky-radio-group | ||
name="mode" | ||
[(ngModel)]="mode" | ||
> | ||
<ul | ||
class="sky-list-unstyled" | ||
> | ||
<li *ngFor="let modeOption of modeOptions"> | ||
<sky-radio | ||
[value]="modeOption.value" | ||
> | ||
<sky-radio-label>{{ modeOption.label }}</sky-radio-label> | ||
</sky-radio> | ||
</li> | ||
</ul> | ||
</sky-radio-group> |
3 changes: 3 additions & 0 deletions
3
src/app/public/modules/demo/demo-control-panel-theme.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ul { | ||
margin: 0; | ||
} |
158 changes: 158 additions & 0 deletions
158
src/app/public/modules/demo/demo-control-panel-theme.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
import { | ||
DebugElement | ||
} from '@angular/core'; | ||
|
||
import { | ||
ComponentFixture, | ||
TestBed | ||
} from '@angular/core/testing'; | ||
|
||
import { | ||
By | ||
} from '@angular/platform-browser'; | ||
|
||
import { | ||
SkyTheme, | ||
SkyThemeMode, | ||
SkyThemeSettings | ||
} from '@skyux/theme'; | ||
|
||
import { | ||
expect | ||
} from '@skyux-sdk/testing'; | ||
|
||
import { | ||
SkyDocsDemoModule | ||
} from './demo.module'; | ||
|
||
import { | ||
SkyDocsDemoControlPanelThemeComponent | ||
} from './demo-control-panel-theme.component'; | ||
|
||
describe('Demo control panel theme', () => { | ||
|
||
function getRadioEls( | ||
fixture: ComponentFixture<SkyDocsDemoControlPanelThemeComponent>, | ||
name: string | ||
): DebugElement[] { | ||
return fixture.debugElement.queryAll(By.css(`sky-radio-group[name="${name}"] sky-radio`)); | ||
} | ||
|
||
function getRadioLabelEl(radioEl: DebugElement): DebugElement { | ||
return radioEl.query(By.css('.sky-switch-label')); | ||
} | ||
|
||
function getRadioInputEl(radioEl: DebugElement): DebugElement { | ||
return radioEl.query(By.css('input[type="radio"]')); | ||
} | ||
|
||
function validateRadioItem( | ||
radioEl: DebugElement, | ||
expectedLabel: string, | ||
expectedValue: string | ||
): void { | ||
const labelEl = getRadioLabelEl(radioEl); | ||
const inputEl = getRadioInputEl(radioEl); | ||
|
||
expect(labelEl.nativeElement).toHaveText(expectedLabel); | ||
expect(inputEl.nativeElement.value).toBe(expectedValue); | ||
} | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
SkyDocsDemoModule | ||
] | ||
}); | ||
}); | ||
|
||
it('should render the expected radio buttons', () => { | ||
const fixture = TestBed.createComponent(SkyDocsDemoControlPanelThemeComponent); | ||
|
||
fixture.detectChanges(); | ||
|
||
const themeRadioEls = getRadioEls(fixture, 'theme'); | ||
|
||
validateRadioItem( | ||
themeRadioEls[0], | ||
'Default', | ||
'default' | ||
); | ||
|
||
validateRadioItem( | ||
themeRadioEls[1], | ||
'Modern', | ||
'modern' | ||
); | ||
|
||
const modeRadioEls = getRadioEls(fixture, 'mode'); | ||
|
||
expect(modeRadioEls.length).toBe(1); | ||
|
||
validateRadioItem( | ||
modeRadioEls[0], | ||
'Light', | ||
'light' | ||
); | ||
}); | ||
|
||
it('should update the mode options based on the selected theme\'s supported modes', () => { | ||
const fixture = TestBed.createComponent(SkyDocsDemoControlPanelThemeComponent); | ||
|
||
fixture.detectChanges(); | ||
|
||
const themeRadioEls = getRadioEls(fixture, 'theme'); | ||
|
||
getRadioInputEl(themeRadioEls[1]).nativeElement.click(); | ||
|
||
fixture.detectChanges(); | ||
|
||
const modeRadioEls = getRadioEls(fixture, 'mode'); | ||
|
||
expect(modeRadioEls.length).toBe(2); | ||
|
||
validateRadioItem( | ||
modeRadioEls[0], | ||
'Light', | ||
'light' | ||
); | ||
|
||
validateRadioItem( | ||
modeRadioEls[1], | ||
'Dark', | ||
'dark' | ||
); | ||
}); | ||
|
||
it('should fire the settings change event when a theme or mode is selected', () => { | ||
const fixture = TestBed.createComponent(SkyDocsDemoControlPanelThemeComponent); | ||
|
||
const themeSettingsChangeEmitSpy = spyOn(fixture.componentInstance.themeSettingsChange, 'emit').and.callThrough(); | ||
|
||
fixture.detectChanges(); | ||
|
||
const themeRadioEls = getRadioEls(fixture, 'theme'); | ||
|
||
getRadioInputEl(themeRadioEls[1]).nativeElement.click(); | ||
|
||
fixture.detectChanges(); | ||
|
||
expect(themeSettingsChangeEmitSpy).toHaveBeenCalledWith( | ||
new SkyThemeSettings( | ||
SkyTheme.presets.modern, | ||
SkyThemeMode.presets.light | ||
) | ||
); | ||
|
||
const modeRadioEls = getRadioEls(fixture, 'mode'); | ||
|
||
getRadioInputEl(modeRadioEls[1]).nativeElement.click(); | ||
|
||
expect(themeSettingsChangeEmitSpy).toHaveBeenCalledWith( | ||
new SkyThemeSettings( | ||
SkyTheme.presets.modern, | ||
SkyThemeMode.presets.dark | ||
) | ||
); | ||
}); | ||
}); |
Oops, something went wrong.