-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Provide custom external css/style (#158)
* Bootstrap test * Material UI test * skip until works * Custom test style
- Loading branch information
1 parent
c3e66b5
commit 4bcdb06
Showing
23 changed files
with
321 additions
and
9 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.my-class { | ||
color: red; | ||
} |
19 changes: 19 additions & 0 deletions
19
examples/ng9/src/app/add-style/add-style.component.cy-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,19 @@ | ||
import { initEnv, mount, setConfig } from 'cypress-angular-unit-test'; | ||
import { AddStyleComponent } from './add-style.component'; | ||
|
||
describe('AddStyleComponent', () => { | ||
|
||
beforeEach(() => { | ||
setConfig({ style: 'p {background-color: blue;}' }); | ||
initEnv(AddStyleComponent); | ||
}); | ||
|
||
it('should create', () => { | ||
mount(AddStyleComponent); | ||
cy.get('p') | ||
.should('contain', 'add-style works!') | ||
.should('have.css', 'color', 'rgb(255, 0, 0)') | ||
.should('have.css', 'background-color', 'rgb(0, 0, 255)'); | ||
}); | ||
|
||
}); |
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 @@ | ||
<p class="my-class"> | ||
add-style works! | ||
</p> |
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,15 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-add-style', | ||
templateUrl: './add-style.component.html', | ||
styleUrls: ['./add-style.component.css'] | ||
}) | ||
export class AddStyleComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
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
Empty file.
17 changes: 17 additions & 0 deletions
17
examples/ng9/src/app/bootstrap-button/bootstrap-button.component.cy-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,17 @@ | ||
import { initEnv, mount, setConfig } from 'cypress-angular-unit-test'; | ||
import { BootstrapButtonComponent } from './bootstrap-button.component'; | ||
|
||
describe('BootstrapButtonComponent', () => { | ||
|
||
beforeEach(() => { | ||
setConfig({ stylesheet: 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css' }); | ||
initEnv(BootstrapButtonComponent); | ||
}); | ||
|
||
it('should create', () => { | ||
mount(BootstrapButtonComponent); | ||
// Should have BootStrap color style | ||
cy.get('button').should('have.css', 'background-color', 'rgb(0, 123, 255)'); | ||
}); | ||
|
||
}); |
1 change: 1 addition & 0 deletions
1
examples/ng9/src/app/bootstrap-button/bootstrap-button.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 @@ | ||
<button type="button" class="btn btn-primary">Primary</button> |
15 changes: 15 additions & 0 deletions
15
examples/ng9/src/app/bootstrap-button/bootstrap-button.component.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,15 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-bootstrap-button', | ||
templateUrl: './bootstrap-button.component.html', | ||
styleUrls: ['./bootstrap-button.component.css'] | ||
}) | ||
export class BootstrapButtonComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
Empty file.
16 changes: 16 additions & 0 deletions
16
examples/ng9/src/app/material-button/material-button.component.cy-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,16 @@ | ||
import { initEnv, mount, setConfig } from 'cypress-angular-unit-test'; | ||
import { MaterialButtonComponent } from './material-button.component'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
|
||
describe('MaterialButtonComponent', () => { | ||
|
||
beforeEach(() => { | ||
setConfig({ cssFile: 'node_modules/@angular/material/prebuilt-themes/indigo-pink.css' }); | ||
initEnv(MaterialButtonComponent, { imports: [MatButtonModule] }); | ||
}); | ||
|
||
it.skip('should create', () => { | ||
mount(MaterialButtonComponent); | ||
}); | ||
|
||
}); |
2 changes: 2 additions & 0 deletions
2
examples/ng9/src/app/material-button/material-button.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,2 @@ | ||
<p>material-button works!</p> | ||
<button mat-raised-button color="primary">Primary</button> |
16 changes: 16 additions & 0 deletions
16
examples/ng9/src/app/material-button/material-button.component.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,16 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import '@angular/material/prebuilt-themes/indigo-pink.css'; | ||
|
||
@Component({ | ||
selector: 'app-material-button', | ||
templateUrl: './material-button.component.html', | ||
styleUrls: ['./material-button.component.css'] | ||
}) | ||
export class MaterialButtonComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
/* You can add global styles to this file, and also import other style files */ | ||
|
||
html, body { height: 100%; } | ||
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } |
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 |
---|---|---|
@@ -1,5 +1,46 @@ | ||
export class CypressAngularConfig { | ||
export class StyleOptions { | ||
|
||
detectChanges = true; | ||
/** | ||
* Creates <link href="..." /> element for each stylesheet | ||
* @alias stylesheet | ||
*/ | ||
stylesheets?: string[]; | ||
|
||
/** | ||
* Creates <link href="..." /> element for each stylesheet | ||
* @alias stylesheets | ||
*/ | ||
stylesheet?: string; | ||
|
||
/** | ||
* Creates <style>...</style> element and inserts given CSS. | ||
* @alias styles | ||
*/ | ||
style?: string; | ||
|
||
/** | ||
* Creates <style>...</style> element for each given CSS text. | ||
* @alias style | ||
*/ | ||
styles?: string[]; | ||
|
||
/** | ||
* Loads each file and creates a <style>...</style> element | ||
* with the loaded CSS | ||
* @alias cssFile | ||
*/ | ||
cssFiles?: string[]; | ||
|
||
/** | ||
* Single CSS file to load into a <style></style> element | ||
* @alias cssFile | ||
*/ | ||
cssFile?: string; | ||
|
||
} | ||
export class CypressAngularConfig extends StyleOptions { | ||
|
||
detectChanges?= true; | ||
|
||
log?= false; | ||
} |
Oops, something went wrong.