Permalink
Browse files

Tests now use the new bootstrap decorator

  • Loading branch information...
1 parent b8bb8af commit 4a89debf08287be5db15bee5119deef88d9cf4ed @davidlgj davidlgj committed Aug 20, 2015
View
@@ -52,6 +52,7 @@
"angular-mocks": ">= 1.2",
"tx-tinymce": ">= 0.0.5",
"angular-ui-sortable": ">=0.12.11",
- "bootstrap-vertical-tabs": "~1.2.0"
+ "bootstrap-vertical-tabs": "~1.2.0",
+ "angular-schema-form-bootstrap": "~0.1.1"
}
}
View
@@ -23,8 +23,7 @@ module.exports = function(config) {
'src/sfPath.js',
'src/services/*.js',
'src/directives/*.js',
- 'src/directives/decorators/bootstrap/*.js',
- 'src/**/*.html',
+ 'bower_components/angular-schema-form-bootstrap/bootstrap-decorator.js',
'test/services/schema-form-test.js',
'test/services/decorators-test.js',
'test/services/messages-test.js',
@@ -43,8 +42,7 @@ module.exports = function(config) {
reporters: ['progress','coverage','growler'],
preprocessors: {
- 'src/**/*.js': ['coverage'],
- 'src/**/*.html': ['ng-html2js']
+ 'src/**/*.js': ['coverage']
},
// optionally, configure the reporter
@@ -53,15 +51,6 @@ module.exports = function(config) {
dir : 'coverage/'
},
-
- ngHtml2JsPreprocessor: {
- cacheIdFromPath: function(filepath) {
- return filepath.substr(4);
- },
- moduleName: 'templates'
- },
-
-
// web server port
port: 9876,
View
@@ -48,7 +48,6 @@
"karma-coverage": "^0.2.1",
"karma-growler-reporter": "0.0.1",
"karma-mocha": "^0.1.3",
- "karma-ng-html2js-preprocessor": "^0.1.0",
"karma-phantomjs-launcher": "^0.1.4",
"mocha": "^1.18.0",
"mocha-lcov-reporter": "0.0.1",
Oops, something went wrong.
@@ -1,7 +1,6 @@
chai.should();
describe('directive',function() {
- beforeEach(module('templates'));
beforeEach(module('schemaForm'));
beforeEach(
//We don't need no sanitation. We don't need no thought control.
@@ -1,3 +0,0 @@
-exports.config = {
- seleniumAddress: 'http://localhost:4444/wd/hub'
-}
@@ -1,74 +0,0 @@
-describe('Schema Form custom validators', function() {
- it('should have a form with content', function() {
- browser.get('http://localhost:8080/examples/custom-validators.html');
-
- expect(element(by.css('form')).getInnerHtml()).not.toEqual('');
- });
-
- describe('#name', function() {
- it('should not complain if it gets a normal name', function() {
- browser.get('http://localhost:8080/examples/custom-validators.html');
- var input = element.all(by.css('form input')).first();
- input.sendKeys('Joe Schmoe');
-
- expect(input.getAttribute('value')).toEqual('Joe Schmoe');
- expect(input.evaluate('ngModel.$valid')).toEqual(true);
-
- });
-
- it('should complain if it gets a "Bob" as a name', function() {
- browser.get('http://localhost:8080/examples/custom-validators.html');
- var input = element.all(by.css('form input')).first();
- input.sendKeys('Bob');
-
- expect(input.getAttribute('value')).toEqual('Bob');
- expect(input.evaluate('ngModel.$valid')).toEqual(false);
- });
- });
-
- describe('#email', function() {
- it('should not complain if it gets a normal email', function() {
- browser.get('http://localhost:8080/examples/custom-validators.html');
- var input = element.all(by.css('form input')).get(1);
- input.sendKeys('foo@mailinator.com');
-
- expect(input.getAttribute('value')).toEqual('foo@mailinator.com');
- expect(input.evaluate('ngModel.$valid')).toEqual(true);
-
- });
-
- it('should complain if it gets a my email', function() {
- browser.get('http://localhost:8080/examples/custom-validators.html');
- var input = element.all(by.css('form input')).get(1);
- input.sendKeys('david.lgj@gmail.com');
-
- expect(input.getAttribute('value')).toEqual('david.lgj@gmail.com');
- expect(input.evaluate('ngModel.$valid')).toEqual(false);
- });
- });
-
- describe('#comment', function() {
- it('should not complain if it gets a normal email', function() {
- browser.get('http://localhost:8080/examples/custom-validators.html');
- var input = element.all(by.css('form input')).get(1);
- input.sendKeys('foo@mailinator.com');
-
- expect(input.getAttribute('value')).toEqual('foo@mailinator.com');
- expect(input.evaluate('ngModel.$valid')).toEqual(true);
-
- });
-
- it('should complain if it gets a my email', function() {
- browser.get('http://localhost:8080/examples/custom-validators.html');
- var input = element.all(by.css('form input')).get(1);
- input.sendKeys('david.lgj@gmail.com');
-
- expect(input.getAttribute('value')).toEqual('david.lgj@gmail.com');
- expect(input.evaluate('ngModel.$valid')).toEqual(false);
- });
- });
-
-
-
-
-});
@@ -1,66 +0,0 @@
-/* global browser, it, describe, element, by */
-
-describe('Schema Form validation messages', function() {
-
- describe('#string', function() {
- var URL = 'http://localhost:8080/examples/bootstrap-example.html#/86fb7505a8ab6a43bc70';
-
- it('should not complain if it gets a normal string', function() {
- browser.get(URL);
- var input = element.all(by.css('form[name=ngform] input')).first();
- input.sendKeys('string');
-
- expect(input.getAttribute('value')).toEqual('string');
- expect(input.evaluate('ngModel.$valid')).toEqual(true);
-
- });
-
-
- var validationMessageTestBuider = function(nr, value, validationMessage) {
- it('should say "' + validationMessage + '" when input is ' + value, function() {
- browser.get(URL);
- var input = element.all(by.css('form[name=ngform] input')).get(nr);
- input.sendKeys(value);
-
- var message = element.all(by.css('form[name=ngform] div[sf-message]')).get(nr);
- expect(input.evaluate('ngModel.$valid')).toEqual(false);
- expect(message.getText()).toEqual(validationMessage);
-
- });
- };
-
- var stringTests = {
- 's': 'String is too short (1 chars), minimum 3',
- 'tooo long string': 'String is too long (11 chars), maximum 10',
- 'foo 66': 'String does not match pattern: ^[a-zA-Z ]+$'
- };
-
- Object.keys(stringTests).forEach(function(value) {
- validationMessageTestBuider(0, value, stringTests[value]);
- });
-
-
- var integerTests = {
- '3': '3 is less than the allowed minimum of 6',
- '66': '66 is greater than the allowed maximum of 50',
- '11': 'Value is not a multiple of 3',
- 'aaa': 'Value is not a valid number'
- };
-
- Object.keys(integerTests).forEach(function(value) {
- validationMessageTestBuider(1, value, integerTests[value]);
- });
-
-
- it('should say "Required" when fields are required', function() {
- browser.get(URL);
- element.all(by.css('form[name=ngform]')).submit();
- var input = element.all(by.css('form[name=ngform] input')).get(1);
-
- var message = element.all(by.css('form[name=ngform] div[sf-message]')).get(1);
- expect(input.evaluate('ngModel.$valid')).toEqual(false);
- expect(message.getText()).toEqual('Required');
-
- });
- });
-});

0 comments on commit 4a89deb

Please sign in to comment.