Skip to content

Commit 2564fc5

Browse files
committed
Add angular tests questions
1 parent e1c29d8 commit 2564fc5

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@
196196
|188| [How do you provide build configuration for multiple locales?](#how-do-you-provide-build-configuration-for-multiple-locales)|
197197
|189| [What is an angular library?](#what-is-an-angular-library)|
198198
|190| [What is AOT compiler?](#what-is-aot-compiler)|
199-
|191| [](#)|
200-
|192| [](#)|
201-
|193| [](#)|
199+
|191| [How do you select an element in component template?](#how-do-you-select-an-element-in-component-template)|
200+
|192| [What is TestBed?](#what-is-testbed)|
201+
|193| [What is protractor?](#what-is-protractor)|
202202
|194| [](#)|
203203
|195| [](#)|
204204
|196| [](#)|
@@ -2916,15 +2916,26 @@
29162916
29172917
**[⬆ Back to Top](#table-of-contents)**
29182918
2919-
191. ### ?
2919+
191. ### How do you select an element in component template?
2920+
You can control any DOM element via ElementRef by injecting it into your component's constructor. i.e, The component should have constructor with ElementRef parameter,
2921+
```javascript
2922+
constructor(myElement: ElementRef) {
2923+
el.nativeElement.style.backgroundColor = 'yellow';
2924+
}
2925+
```
29202926
29212927
**[⬆ Back to Top](#table-of-contents)**
29222928
2923-
192. ### ?
2929+
192. ### What is TestBed?
2930+
TestBed is an api for writing unit tests for Angular applications and it's libraries. Even though We still write our tests in Jasmine and run using Karma, this API provides an easier way to create components, handle injection, test asynchronous behaviour and interact with our application.
29242931
29252932
**[⬆ Back to Top](#table-of-contents)**
29262933
2927-
193. ### ?
2934+
193. ### What is protractor?
2935+
Protractor is an end-to-end test framework for Angular and AngularJS applications. It runs tests against your application running in a real browser, interacting with it as a user would.
2936+
```javascript
2937+
npm install -g protractor
2938+
```
29282939
29292940
**[⬆ Back to Top](#table-of-contents)**
29302941

0 commit comments

Comments
 (0)