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

Commit

Permalink
Merge pull request #532 from hrgui/fix-to
Browse files Browse the repository at this point in the history
fix(fieldGroup): add shortcut for templateOptions
  • Loading branch information
Kent C. Dodds committed Oct 31, 2015
2 parents 8a542d5 + 4417dd2 commit f229710
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/directives/formly-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ function formlyField($http, $q, $compile, $templateCache, $interpolate, formlyCo
function setupFieldGroup() {
$scope.options.options = $scope.options.options || {}
$scope.options.options.formState = $scope.formState
$scope.to = $scope.options.templateOptions
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/directives/formly-form.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ describe('formly-form', () => {
<div class="heading">
Panel Title: {{options.templateOptions.title}}
</div>
<div class="sub-heading">
Subtitle: {{to.subtitle}}
</div>
<div class="body">
<formly-transclude></formly-transclude>
</div>
Expand All @@ -300,6 +303,7 @@ describe('formly-form', () => {
wrapper: 'panel',
templateOptions: {
title: 'My Panel',
subtitle: 'is awesome',
},
fieldGroup: [
getNewField(),
Expand All @@ -320,6 +324,10 @@ describe('formly-form', () => {
expect(headingNode).to.exist
const headingEl = angular.element(headingNode)
expect(headingEl.text().trim()).to.eq('Panel Title: My Panel')
const subHeadingNode = panelNode.querySelector('.sub-heading')
expect(subHeadingNode).to.exist
const subHeadingEl = angular.element(subHeadingNode)
expect(subHeadingEl.text().trim()).to.eq('Subtitle: is awesome')
})

it(`should be possible to hide a fieldGroup with the hide property`, () => {
Expand Down

0 comments on commit f229710

Please sign in to comment.