When using Karma to test client - side codes, it is better to leave them as it is when changing codes. Hence, anomaly can be detected as soon as there is a change in the codes.
There is this end - to - end test used in full stack web development. These tests are used to simulate user's input to the web application.
In the example provided in https://docs.angularjs.org/tutorial/, end - to - end codes can be ran with npm run
and then in separate terminal run npm run protractor
.
I think, this end - to - end unit test is using protractor
(https://www.npmjs.com/package/protractor) npm
package.
This protractor
E2E test has dependency to Selenium Standalone Server which needs Java JDK. However, I am not sure yet how the error looks like.
What is angular-seed
? angular-seed
is a skeleton project of AngularJs. Perhaps, it used to kick - start the development of Angular based application.
* The first codes from the tutorial.
<!doctype html>
<html lang="en" ng-app>
<head>
<meta charset="utf-8">
<title>my html file</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<script src="bower_components/angular/angular.js"></script>
</head>
<body>
<p>nothing here {{ "yet" + "!" }}</p>
</body>
</html>
ng-app
in <html lang="en" ng-app>
is a must. This is what determine a web page is an AngularJS based application. This also determine the root of application.<script src="bower_components/angular/angular.js"></script>
in the head instead of in the end of the <body>
.<script src="bower_components/angular/angular.js"></script>
in the end of the <body>
the DOM will get rendered first then Angular re-render back the web page. I think this could be the solution from my previous Toyota web project.{{ ... }}
is used to evaluate expression. For example {{ 1 + 2 }}
will display 3 in a designated DOM element.ng-app
, it will automatically re - bind with AngularJS when the document loads.ng-non-bindable
DOM properties.ng-model
directive is usually used to control HTML DOM that can induce controls to the users (button, input, ...).ng-init
can be called in a control - flow (for example <input>
) with ng-model
that called the variable name.ng-init
to declare variable is not very common! Usually in professional level the variable is declared within a $scope
in a controlled mentioned in the script.<div>
and <span>
.<!doctype>
<html>
<head>
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
</head>
<body ng-app="" ng-init="names=['hello','world','!'];">
<div ng-repeat="i in names">{{ i }} </div>
</body>
</html>
hello
world
!
<!doctype>
<html>
<head>
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
</head>
<body ng-app="" ng-init="names=['hello','world','!'];">
<span ng-repeat="i in names">{{ i }}</span>
</body>
</html>
helloworld!