Skip to content

Commit a07e352

Browse files
committed
feat(bs3) BS3 only
1 parent 05cd985 commit a07e352

File tree

12 files changed

+50
-50
lines changed

12 files changed

+50
-50
lines changed

.npmignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ build.xml
1313
generated
1414
bower_components
1515
config
16-
dist
17-
fonts
1816
js
19-
less
2017
scripts
2118
node_modules
2219
template

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# forms-angular
22

33
## 0.6.0 to 0.7.0
4+
* Removed support for Bootstrap 2 (just in time for Bootstrap 4?)
45
* Fixed bug with ui-router setup which meant that full routes were not parsed.
56
* Added internal templates for lists, edit forms and report forms (previously they were in the Yeoman generator).
67
* Internal templates can be over-ridden by specifying a templateFolder property in the routing config.
78
### BREAKING CHANGES
8-
* To use the edit / list / report templates from a pre 0.7.0 application you must specify a templateFolder property of 'partials' when starting the routingService when configuring forms-angular
9+
* To use the edit / list / report templates from a pre 0.7.0 application you must specify a templateFolder property of 'partials' when starting the routingService when configuring forms-angular
10+
* Removed support for Bootstrap 2 (though your BS2 apps should still work - www.forms-angular.org is still BS2)
911

1012
## 0.5.1 to 0.6.0
1113
* Upgrade to angular-ui-bootstrap 0.14.x, which drops support for Bootstrap 2 (but seems to work fine for the forms-angular.org website, which is BS2)

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"angular": "1.5.5",
2222
"angular-sanitize": "1.5.5",
2323
"angular-messages": "1.5.5",
24-
"angular-ui-bootstrap-bower": "0.14.3",
24+
"angular-ui-bootstrap-bower": "1.3.2",
2525
"underscore": "1.8.3",
2626
"ngInfiniteScroll": "1.2.1",
2727
"angular-elastic": "2.5.1"

dist/forms-angular.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,11 +1381,10 @@ var fng;
13811381
(function (services) {
13821382
/*@ngInject*/
13831383
function cssFrameworkService() {
1384-
// Supported options for framework are:
1385-
// bs2 = Twitter Bootstrap 2.3.2 (default)
1386-
// bs3 = Bootstrap 3.3.5
1384+
// Bootstrap 3 is now the only supported framework
1385+
// Bootstrap 2 can be made to work - an example can be made available if you request on gitter.
13871386
var config = {
1388-
framework: 'bs2' // Unit tests depend on this being bs2
1387+
framework: 'bs3'
13891388
};
13901389
return {
13911390
setOptions: function (options) {

dist/forms-angular.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
17.6 KB
Binary file not shown.

js/services/css-framework.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ module fng.services {
44

55
/*@ngInject*/
66
export function cssFrameworkService() {
7-
// Supported options for framework are:
8-
// bs2 = Twitter Bootstrap 2.3.2 (default)
9-
// bs3 = Bootstrap 3.3.5
7+
// Bootstrap 3 is now the only supported framework
8+
// Bootstrap 2 can be made to work - an example can be made available if you request on gitter.
109
var config = {
11-
framework: 'bs2' // Unit tests depend on this being bs2
10+
framework: 'bs3'
1211
};
1312

1413
return {

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@
3434
"async": "1.5.2",
3535
"mongoose": "4.3.6",
3636
"node.extend": "1.1.5",
37-
"underscore": "1.8.3"
37+
"underscore": "1.8.3",
38+
"angular": "1.5.5",
39+
"angular-sanitize": "1.5.5",
40+
"angular-messages": "1.5.5",
41+
"angular-ui-bootstrap": "1.3.2",
42+
"ng-infinite-scroll": "1.2.1",
43+
"angular-elastic": "2.5.1"
3844
},
3945
"devDependencies": {
4046
"del": "2.2.0",

test/example-directives/bespoke-field-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ formsAngular.directive('emailField', ['$compile', '$filter', 'cssFrameworkServic
1818
template += '<label class="control-label" for="' + info.id + '">' + info.label + '</label>';
1919
}
2020
template += '<div class="controls">' +
21-
'<div class="input-prepend">' +
21+
'<div class="input-prepend test-class">' +
2222
'<span class="add-on">@</span>' +
2323
'<input type="email" ng-model="record.' + info.name + '" id="' + info.id + '" name="' + info.id + '" />' +
2424
'</div>' +
@@ -33,7 +33,7 @@ formsAngular.directive('emailField', ['$compile', '$filter', 'cssFrameworkServic
3333
template += '<label class="col-sm-2" for="' + info.id + '">' + info.label + '</label>';
3434
}
3535
template += '<div class="col-sm-10">' +
36-
'<div class="col-xs-4">' +
36+
'<div class="col-xs-4 test-class">' +
3737
'<div class="input-group">' +
3838
'<span class="input-group-addon input-sm">@</span>' +
3939
'<input type="email" class="form-control input-sm" ng-model="record.' + info.name + '" id="' + info.id + '" name="' + info.id + '" />' +

test/unit/formBespokeSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('formBespokeInput', function () {
3636
expect(input.attr('type')).toBe('email');
3737

3838
var prepend = angular.element(elm.find('div')[2]);
39-
expect(prepend).toHaveClass('input-prepend');
39+
expect(prepend).toHaveClass('test-class');
4040
expect(prepend.length).toBe(1);
4141
expect(prepend.text()).toBe('@');
4242
});

test/unit/formInputSpec.js

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ describe('formInput', function () {
107107
}));
108108

109109
it('has Exams section', function () {
110-
var thisElm = angular.element(elm.find('div')[5]);
110+
var thisElm = angular.element(elm.find('div')[7]);
111111
expect(thisElm).toHaveClass('schema-head');
112112
expect(thisElm.text()).toBe('Exams');
113113

114-
thisElm = angular.element(elm.find('div')[20]);
114+
thisElm = angular.element(elm.find('div')[26]);
115115
expect(thisElm).toHaveClass('schema-foot');
116116

117117
thisElm = thisElm.find('button');
@@ -120,9 +120,9 @@ describe('formInput', function () {
120120
thisElm = elm.find('div');
121121
expect(thisElm).toHaveClassCount('sub-doc', 2);
122122

123-
thisElm = angular.element(elm.find('div')[6]);
123+
thisElm = angular.element(elm.find('div')[8]);
124124
expect(thisElm.attr('id')).toBe('f_examsList_0');
125-
thisElm = angular.element(elm.find('div')[13]);
125+
thisElm = angular.element(elm.find('div')[17]);
126126
expect(thisElm.attr('id')).toBe('f_examsList_1');
127127

128128
thisElm = elm.find('input');
@@ -156,7 +156,7 @@ describe('formInput', function () {
156156
it('has amended Exams section head', function () {
157157
var thisElm = elm.find('div');
158158
expect(thisElm).toHaveClassCount('schema-head', 1);
159-
thisElm = angular.element(elm.find('div')[5]);
159+
thisElm = angular.element(elm.find('div')[7]);
160160
expect(thisElm.text()).toBe('Exams');
161161
});
162162

@@ -210,9 +210,9 @@ describe('formInput', function () {
210210
expect(input.attr('type')).toBe('text');
211211
});
212212

213-
it('should have 2 label', function () {
213+
it('should have 2 visible labels', function () {
214214
var label = elm.find('label');
215-
expect(label.length).toBe(2);
215+
expect(label.length).toBe(4);
216216

217217
label = angular.element(elm.find('label')[0]);
218218
expect((label).text()).toBe('Name');
@@ -221,6 +221,15 @@ describe('formInput', function () {
221221
label = angular.element(elm.find('label')[1]);
222222
expect((label).text()).toBe('Nickname');
223223
expect(label.attr('for')).toBe('f_nickname');
224+
225+
label = angular.element(elm.find('label')[2]);
226+
expect((label).text()).toBe('');
227+
expect(label.attr('for')).toBe('f_hairColour');
228+
229+
label = angular.element(elm.find('label')[3]);
230+
expect((label).text()).toBe('');
231+
expect(label.attr('for')).toBe('_2');
232+
224233
});
225234

226235
});
@@ -281,7 +290,7 @@ describe('formInput', function () {
281290
expect(help.text()).toBe('This is some help');
282291

283292
help = angular.element(elm.find('span')[1]);
284-
expect(help).toHaveClass('help-inline');
293+
// expect(help).toHaveClass('help-inline'); No such thing in BS3
285294
expect(help.text()).toBe('This is some inline help');
286295
});
287296

@@ -797,7 +806,7 @@ describe('formInput', function () {
797806
var input = elm.find('input');
798807
expect(input).toHaveClass('ng-pristine');
799808
expect(input).toHaveClass('ng-valid');
800-
expect(input).toHaveClass('input-small');
809+
expect(input).toHaveClass('input-sm');
801810
expect(input.attr('id')).toBe('desc_id');
802811
expect(input.attr('type')).toBe('text');
803812
});
@@ -834,19 +843,19 @@ describe('formInput', function () {
834843
}));
835844

836845
it('on simple field', function () {
837-
var cg = angular.element(elm.find('div')[2]);
846+
var cg = angular.element(elm.find('div')[3]);
838847
expect(cg.attr('id')).toBe('cg_desc_id');
839848
expect(cg.attr('ng-show')).toBe('record.boolean===true');
840849
});
841850

842851
it('on nested field', function () {
843-
var cg = angular.element(elm.find('span')[0]);
852+
var cg = angular.element(elm.find('div')[11]);
844853
expect(cg.attr('id')).toBe('cg_f_exams_subject');
845854
expect(cg.attr('ng-show')).toBe('record.boolean===true');
846855
});
847856

848857
it('dependent on nested field', function () {
849-
var cg = angular.element(elm.find('span')[2]);
858+
var cg = angular.element(elm.find('div')[13]);
850859
expect(cg.attr('id')).toBe('cg_f_exams_retakeDate');
851860
expect(cg.attr('ng-show')).toBe('record.exams[$index].result===\'fail\'');
852861
});
@@ -999,9 +1008,10 @@ describe('formInput', function () {
9991008
scope.$digest();
10001009
}));
10011010

1002-
it('should not have a label', function () {
1011+
it('should not have a visible label', function () {
10031012
var label = elm.find('label');
1004-
expect(label.length).toBe(0);
1013+
expect(label.length).toBe(1);
1014+
expect(label).toHaveClass('sr-only');
10051015
});
10061016

10071017
});
@@ -1021,19 +1031,6 @@ describe('formInput', function () {
10211031
});
10221032
});
10231033

1024-
it('adds a class to text input without size using add (deprecated behaviour)', function() {
1025-
inject(function ($rootScope, $compile) {
1026-
elm = angular.element('<div><form-input formStyle="inline" schema="formSchema"></form-input></div>');
1027-
scope = $rootScope;
1028-
scope.formSchema = {name: 'desc', id: 'descId', label: 'Description', type: 'text', add: 'class="some class"'};
1029-
$compile(elm)(scope);
1030-
scope.$digest();
1031-
var input = elm.find('input');
1032-
expect(input).toHaveClass('some');
1033-
expect(input).toHaveClass('class');
1034-
});
1035-
});
1036-
10371034
it('adds a class to text input without size using class', function() {
10381035
inject(function ($rootScope, $compile) {
10391036
elm = angular.element('<div><form-input formStyle="inline" schema="formSchema"></form-input></div>');

test/unit/searchSpec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ describe('search', function () {
2323

2424
it('should have a search form', function () {
2525
var form = elm.find('form');
26-
expect(form).toHaveClass('navbar-search');
26+
expect(form).toHaveClass('navbar-form');
2727
});
2828

2929
it('should not have an error class in the search box when the form is created', function () {
3030
var div = angular.element(elm.find('div')[0]);
3131
expect(div.attr('id')).toBe('search-cg');
32-
expect(div.attr('class')).toBe('control-group');
32+
expect(div.attr('class')).toBe('form-group');
3333
});
3434

3535
});
@@ -58,7 +58,7 @@ describe('search', function () {
5858
var results = elm.find('span');
5959
expect(results.length).toBe(2);
6060
var div = angular.element(elm.find('div')[0]);
61-
expect(div.attr('class')).toBe('control-group');
61+
expect(div.attr('class')).toBe('form-group');
6262
});
6363

6464
it('should have an error class in the search box when the string is not found', function () {
@@ -69,10 +69,10 @@ describe('search', function () {
6969
var results = elm.find('span');
7070
expect(results.length).toBe(0);
7171
var div = angular.element(elm.find('div')[0]);
72-
expect(div.attr('class')).toBe('control-group error has-error');
72+
expect(div.attr('class')).toBe('form-group error has-error');
7373
scope.searchTarget = '';
7474
scope.$digest();
75-
expect(div.attr('class')).toBe('control-group');
75+
expect(div.attr('class')).toBe('form-group');
7676
});
7777

7878
it('formats results', function () {

0 commit comments

Comments
 (0)