Angular/Unit testing Flashcards

1
Q

What is Angular?

A

Angular is a front end web application framework/platform that enables us to create single page web applications in an architectural style that allows us to scale and maintain with ease.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what does SPA stand for?

A

Single page application

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

type of web application where we receive the entire html/css/js to render an app in the first GET request. Unlike static websites where we get html pages served by a server, we instead receive json data from the server and render as needed. The “change in the view” is done by swapping various html elements depending on the condition/user interactions - via JS manipulating the DOM This means that once the SPA loads, there is no refresh.

A

SPA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Advantages of SPA

A

Once the app loads, the application in general is faster because it’s not receiving entire html pages from the server

Because we use AJAX to receive data, our application will stay responsive and not freeze on us (which means, if we happen to be waiting for a huge data that takes a lot of time to load, instead of freezing, we can do things like, displaying the loading bar or spinner)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Disadvantages of SPA

A

overhead to configure and learn a particular framework

the initial request can be slower than static webpages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Angular uses ES2015 module system to practice separation of concerns It works kind of like namespaces in C# Modules are decorated with @ngModule decorator to let the angular compiler know that it is angular module with additional metadata about it Before we can use any components, we need to have them belong somewhere, by registering them to a module, by including the component name in declaration section of ngModule decoration If you want to use components from a different module, we first need to import the module that has that particular component, in the imports section. We separate modules by features In order to generate modules, use ng g module

A

Modules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

reusable pieces of view that is bundled with its own logic, styles, and tests. They are one of the core parts of angular application and mainly handles user interactions and view display.

A

Components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

_____ tell angular that it is of a certain type (such as @ngModule or @Component) Angular takes the metadata that’s been passed inside the _____, and then adds them to the object. (the module/class)

A

Decorators

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

reusable pieces of logic that can be shared across components. They are handled by angular’s dependency injection, and are decorated with @injectable decorator.

A

Services

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

a technique in which an object receives other objects that it depends on, called dependencies.

A

Dependency Injection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

take actions depending on the lifecycle of the component. For example, we can tell it to execute a certain action when the component loads, by placing the logic in ngOnInit(). Also, if we have resources that we need to dispose of, we can do so during ngOnDestory() (there are more)

A

Lifecycle hooks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Angular ____ provide additional functionality to the html pages/view. Two types: Structural, and attribute directives structural directives change the structure of dom/html page - so things like ngIf, ngFor, anything that adds or removes html elements are structural directives Attribute directives changes the look and feel of elements - like ngStyle

A

Directives

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

JS events occur in ___ phases

A

3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

JS event phases

A

Capture phase
Event target
Bubbling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

the event travels from window object to the event target

A

Capture phase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

the event reaches the target element and the event listener responds

A

Event target

17
Q

the event travels back up from the target element to the window

A

Bubbling

18
Q

verifying somebody’s identity

A

Authentication

19
Q

verifying if they can access this particular resource and/or take a certain action.

A

Authorization

20
Q

Interpolation

A

{{}}:

21
Q

Property Binding

A

[]:

22
Q

Event binding

A

():

23
Q

Two-way binding

A

[()]:

24
Q

use publisher/subscriber model and whenever there are any changes, all subscribers are notified of them.

A

Observables

25
Q

closed after the result has been returned. Once it is fulfilled it’s done.

A

Promises

26
Q

query params are not declared in routes array but instead passed when navigating to it

A

True

27
Q

tag acts as a placeholder for the views you want to present depending on your routes.

A

router-outlet

28
Q

transform data from one format to another, usually to the ones that can be displayed on the view

A

Pipes

29
Q

Testing small units of your code.

A

Unit testing

30
Q

unit testing framework

A

Xunit

31
Q

Parts of a unit test

A

Arrange
Act
Assert

32
Q

This is any setup necessary to prepare for the behavior to test. You assume the thing you wanna test works.

A

Arrange

33
Q

You do the thing you wanna test. You usually name the method after the thing you wanna test.

A

Act

34
Q

Verify the behavior was as expected, sometimes on the same step as ACT.

A

Assert

35
Q

what does TDD stand for?

A

Test Driven Development

36
Q

Write tests that fail

Implement code to make tests pass

A

Test Driven Development