Skip to content
This repository has been archived by the owner on Apr 30, 2018. It is now read-only.

Commit

Permalink
v8.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
formly-bot committed May 15, 2016
2 parents 73c85fe + 64a8694 commit 56ecbf5
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 13 deletions.
12 changes: 6 additions & 6 deletions dist/formly.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-formly JavaScript Library v8.2.0
* angular-formly JavaScript Library v8.2.1
*
* @license MIT (http://license.angular-formly.com)
*
Expand Down Expand Up @@ -157,7 +157,7 @@ return /******/ (function(modules) { // webpackBootstrap

ngModule.constant('formlyApiCheck', _providersFormlyApiCheck2['default']);
ngModule.constant('formlyErrorAndWarningsUrlPrefix', _otherDocsBaseUrl2['default']);
ngModule.constant('formlyVersion', ("8.2.0")); // <-- webpack variable
ngModule.constant('formlyVersion', ("8.2.1")); // <-- webpack variable

ngModule.provider('formlyUsability', _providersFormlyUsability2['default']);
ngModule.provider('formlyConfig', _providersFormlyConfig2['default']);
Expand Down Expand Up @@ -435,7 +435,7 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = "https://github.com/formly-js/angular-formly/blob/" + ("8.2.0") + "/other/ERRORS_AND_WARNINGS.md#";
exports["default"] = "https://github.com/formly-js/angular-formly/blob/" + ("8.2.1") + "/other/ERRORS_AND_WARNINGS.md#";
module.exports = exports["default"];

/***/ },
Expand Down Expand Up @@ -668,7 +668,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (!_angularFix2['default'].isDefined(extendsDO)) {
return;
}
var optionsDO = options.defaultOptions;
var optionsDO = options.defaultOptions || {};
var optionsDOIsFn = _angularFix2['default'].isFunction(optionsDO);
var extendsDOIsFn = _angularFix2['default'].isFunction(extendsDO);
if (extendsDOIsFn) {
Expand All @@ -680,8 +680,8 @@ return /******/ (function(modules) { // webpackBootstrap
if (optionsDOIsFn) {
extenderOptionsDefaultOptions = extenderOptionsDefaultOptions(mergedDefaultOptions, scope);
}
_otherUtils2['default'].reverseDeepMerge(extendsDefaultOptions, extenderOptionsDefaultOptions);
return extendsDefaultOptions;
_otherUtils2['default'].reverseDeepMerge(extenderOptionsDefaultOptions, extendsDefaultOptions);
return extenderOptionsDefaultOptions;
};
} else if (optionsDOIsFn) {
options.defaultOptions = function defaultOptions(opts, scope) {
Expand Down
4 changes: 2 additions & 2 deletions dist/formly.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/formly.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-formly",
"version": "8.2.0",
"version": "8.2.1",
"author": "Astrism <astrisms@gmail.com>",
"contributors": [
"Astrism <astrisms@gmail.com>",
Expand Down
6 changes: 3 additions & 3 deletions src/providers/formlyConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function formlyConfig(formlyUsabilityProvider, formlyErrorAndWarningsUrlPrefix,
if (!angular.isDefined(extendsDO)) {
return
}
const optionsDO = options.defaultOptions
const optionsDO = options.defaultOptions || {}
const optionsDOIsFn = angular.isFunction(optionsDO)
const extendsDOIsFn = angular.isFunction(extendsDO)
if (extendsDOIsFn) {
Expand All @@ -136,8 +136,8 @@ function formlyConfig(formlyUsabilityProvider, formlyErrorAndWarningsUrlPrefix,
if (optionsDOIsFn) {
extenderOptionsDefaultOptions = extenderOptionsDefaultOptions(mergedDefaultOptions, scope)
}
utils.reverseDeepMerge(extendsDefaultOptions, extenderOptionsDefaultOptions)
return extendsDefaultOptions
utils.reverseDeepMerge(extenderOptionsDefaultOptions, extendsDefaultOptions)
return extenderOptionsDefaultOptions
}
} else if (optionsDOIsFn) {
options.defaultOptions = function defaultOptions(opts, scope) {
Expand Down
62 changes: 62 additions & 0 deletions src/providers/formlyConfig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,68 @@ describe('formlyConfig', () => {
})

})

describe(`abstractType function case`, () => {
beforeEach(() => {
setterFn([
{
name,
template,
defaultOptions: function(options) {
return {
templateOptions: {
required: true,
min: 3,
},
}
},
},
{
name: 'type2',
extends: name,
defaultOptions: function(options) {
return {
templateOptions: {
required: false,
max: 4,
},
}
},
},
{
name: 'type3',
extends: name,
defaultOptions: {
templateOptions: {
required: false,
max: 4,
},
},
},
])
})

it(`should merge options when extending defaultOptions is a function`, () => {
expect(getterFn('type2').defaultOptions({})).to.eql({
templateOptions: {
required: false,
min: 3,
max: 4,
},
})
})

it(`should merge options when extending defaultOptions is an object`, () => {
expect(getterFn('type3').defaultOptions({})).to.eql({
templateOptions: {
required: false,
min: 3,
max: 4,
},
})
})

})

describe(`template/templateUrl Cases`, () => {
it('should use templateUrl if type defines it and its parent has template defined', function() {
Expand Down

0 comments on commit 56ecbf5

Please sign in to comment.