<!doctype html>
-<html lang="<%= $lang %>" ng-app="myApp" xmlns:ng="http://angularjs.org">
+% my $test = param('test');
+<html lang="<%= $lang %>" ng-app="<%= $test ? 'testApp' : 'myApp' %>" xmlns:ng="http://angularjs.org">
<head>
<meta charset="utf-8">
<title><%= locale
<link rel="stylesheet" href="/css/app.css"/>
<link rel="stylesheet" href="/css/drzb2013.css"/>
+ <!--[if IE 7]>
+ <script src="scripts/vendor/es5-shim.min.js"></script>
+ <script src="scripts/vendor/json3.min.js"></script>
+ <![endif]-->
+
<!--[if lte IE 8]>
<script>
document.createElement('ng-include');
<script src="/js/controllers.js"></script>
<script src="/js/filters.js"></script>
<script src="/js/directives.js"></script>
+
+% if ( $test ) {
+ <script src="/test/lib/angular/angular-mocks.js"></script>
+ <script type="text/javascript">
+// https://groups.google.com/forum/?fromgroups=#!searchin/angular/e2e$20mock|sort:date/angular/ObdxCoCObYU/KENkGVfIZYkJ
+
+angular.module('testApp', ['myApp', 'ngMockE2E' ]).
+ run(function ($httpBackend) {
+ console.log('mock $httpBackend', $httpBackend);
+ $httpBackend.whenGET(/partials\/.*/).passThrough();
+ $httpBackend.whenJSONP(/./).passThrough();
+ $httpBackend.whenGET(/registration/).passThrough();
+ }
+);
+
+// mock console for IE
+if(!window.console) {
+ window.console = new function() {
+ this.log = function(str) {};
+ this.info = function(str) {};
+ this.debug = function(str) {};
+ };
+}
+
+
+console.log('mock testApp');
+
+ </script>
+% }
+
</body>
</html>
</fieldset><!-- has_work -->
-<div ng-show="user.registration_type == 'symposium'">
+<div ng-show="user.registration_type == 'symposium'" id="symposium-works">
<h2><%= locale
en=>'Submission of works for the symposium {{work.title}}',
hr=>'Prijava radova unutar simpozija {{work.title}}' %>
</h2>
-<div ng-repeat="work in work.symposium_works" class="control-row">
+<div ng-repeat="work in work.symposium_works" class="control-row work">
<h3><%= locale
en=>'{{$index + 1}}. symposium work',
</div><!-- user.registration_type == 'symposium' -->
-<button class="controls-row btn btn-primary" ng-click="update(registration,'confirmation')" ng-show="RegistrationForm.$valid"><%= locale en=>'Submit',hr=>'Pošalji' %></button>
+<button class="controls-row btn btn-primary" id="update-registration" ng-click="update(registration,'confirmation')" ng-show="RegistrationForm.$valid"><%= locale en=>'Submit',hr=>'Pošalji' %></button>
<p class="well" style="color: red" ng-show="! RegistrationForm.$valid">
<%= locale
en => 'Please fill all required fields correctly. Fields with red border call for your attention.',
hr => 'Molimo ispunite sva obavezna polja označena crvenim okvirom.'
%>
-<button class="controls-row btn btn-info" ng-click="update(registration,'draft')" ng-show="RegistrationForm.$dirty"><%= locale en=>'Save draft',hr=>'Spremi privremeno' %></button>
+<button class="controls-row btn btn-info" id="update-draft" ng-click="update(registration,'draft')" ng-show="RegistrationForm.$dirty"><%= locale en=>'Save draft',hr=>'Spremi privremeno' %></button>
</p>
<input style="float:right" title="validation errors" type=checkbox name=debug ng-click="debug = ! debug">
basePath = '../';
files = [
- ANGULAR_SCENARIO,
- ANGULAR_SCENARIO_ADAPTER,
- 'test/e2e/**/*.js'
+ JASMINE,
+ JASMINE_ADAPTER,
+ 'test/lib/angular/angular-scenario.js',
+ 'test/e2e/*.js'
];
autoWatch = false;
singleRun = true;
proxies = {
- '/': 'http://localhost:8000/'
+ '/': 'http://localhost:3001/'
};
junitReporter = {
describe('my app', function() {
beforeEach(function() {
- browser().navigateTo('/lang/en/drzb2013.html');
+ browser().navigateTo('/lang/en-dev/drzb2013.html?test=mock');
});
describe('registration', function() {
beforeEach(function() {
- browser().navigateTo('#/registration');
+ browser().navigateTo('#/registration');
});
toMatch(/Registration/);
});
+ it('has warning box', function() {
+ expect(element('p.well').text()).toBeTruthy();
+ });
+
+ it('invalid form', function() {
+ expect(binding('RegistrationForm.$valid')).toEqual('false');
+ });
+
+ it('save draft button', function() {
+ expect(input('user.registration_type').select('symposium')).toBeDefined;
+ expect(binding('RegistrationForm.$valid')).toEqual('false');
+ expect(element('input#save-draft')).toBeDefined;
+ });
+
+ it('symposium has 4 works by default', function() {
+ input('user.registration_type').select('symposium');
+ input('user.firstname').enter('name');
+// expect(element(':input[ng-model="user.registration_type"]').val()).toBe('symposium');
+ var r = using('div#symposium-works').repeater('div.work');
+ expect(r.count()).toBe(4);
+// expect(r.row(0)).toEqual({});
+ });
+
});