Skip to content

Commit 7cf3dda

Browse files
committed
Add angular test framework and polyfill questions
1 parent fc2957f commit 7cf3dda

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

README.md

+28-6
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@
153153
|145| [How do you upgrade angular version?](#how-do-you-upgrade-angular-version)|
154154
|146| [What is Angular Material?](#what-is-angular-material)|
155155
|147| [How do you upgrade location service of angularjs?](#how-do-you-upgrade-location-service-of-angularjs)|
156-
|148| [](#)|
157-
|149| [](#)|
158-
|150| [](#)|
156+
|148| [What is NgUpgrade?](#what-is-ngupgrade)|
157+
|149| [How do you test Angular application using CLI?](#how-do-you-test-angular-application-using-cli)|
158+
|150| [How to use polyfills in Angular application?](#how-to-use-polyfills-in-angular-application)|
159159

160160
1. ### What is Angular Framework?
161161

@@ -1911,6 +1911,28 @@
19111911
})
19121912
export class AppModule {}
19131913
```
1914-
148. ### ?
1915-
149. ### ?
1916-
150. ### ?
1914+
148. ### What is NgUpgrade?
1915+
NgUpgrade is a library put together by the Angular team, which you can use in your applications to mix and match AngularJS and Angular components and bridge the AngularJS and Angular dependency injection systems.
1916+
149. ### How do you test Angular application using CLI?
1917+
Angular CLI downloads and install everything needed with the Jasmine Test framework. You just need to run `ng test` to see the test results. By default this command builds the app in watch mode, and launches the `Karma test runner`. The output of test results would be as below,
1918+
```bash
1919+
10% building modules 1/1 modules 0 active
1920+
...INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
1921+
...INFO [launcher]: Launching browser Chrome ...
1922+
...INFO [launcher]: Starting browser Chrome
1923+
...INFO [Chrome ...]: Connected on socket ...
1924+
Chrome ...: Executed 3 of 3 SUCCESS (0.135 secs / 0.205 secs)
1925+
```
1926+
**Note:** A chrome browser also opens and displays the test output in the "Jasmine HTML Reporter".
1927+
150. ### How to use polyfills in Angular application?
1928+
The Angular CLI provides support for polyfills officially. When you create a new project with the ng new command, a `src/polyfills.ts` configuration file is created as part of your project folder. This file includes the mandatory and many of the optional polyfills as JavaScript import statements. Let's categorize the polyfills,
1929+
1. **Mandatory polyfills:** These are installed automatically when you create your project with ng new command and the respective import statements enabled in 'src/polyfills.ts' file.
1930+
2. **Optional polyfills:** You need to install its npm package and then create import statement in 'src/polyfills.ts' file.
1931+
For example, first you need to install below npm package for adding web animations (optional) polyfill.
1932+
```bash
1933+
npm install --save web-animations-js
1934+
```
1935+
and create import statement in polyfill file.
1936+
```javascript
1937+
import 'web-animations-js';
1938+
```

0 commit comments

Comments
 (0)