Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/app/directives/__test__/mcTextareaWithButton.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
describe('Textarea with button directive', function() {
var $compile,
$rootScope;

// Load the myApp module, which contains the directive
beforeEach(module('myApp'));

// Store references to $rootScope and $compile
// so they are available to all tests in this describe block
beforeEach(inject(function(_$compile_, _$rootScope_){
// The injector unwraps the underscores (_) from around the parameter names when matching
$compile = _$compile_;
$rootScope = _$rootScope_;
}));

it('Replaces the element with the appropriate content', function() {
// Compile a piece of HTML containing the directive
var element =
$compile("<mc-textarea-with-button><mc-button></mc-button><mc-field></mc-field></mc-textarea-with-button>")
($rootScope);
// fire all the watches, so the scope expression {{1 + 1}} will be evaluated
$rootScope.$digest();
// Check that the compiled element contains the templated content
expect(element.html()).toContain("div");
});
});
15 changes: 15 additions & 0 deletions src/app/directives/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,4 +459,19 @@ angular.module('ripple-ui.directives', [])
});
}
};
})
.directive('mcTextareaWithButton', function () {
return{
restrict: 'E',
transclude: {
button: '?mcButton',
field: '?mcField'
},
template:
' <div class="input-holder">\n' +
' <div class="control-group right buttoned-control-group" ng-transclude="button">\n' +
' </div>\n' +
' <div ng-transclude="field"></div>\n' +
' </div>\n'
}
});
5 changes: 5 additions & 0 deletions src/app/scss/components/_control.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
@include clearfix;
&.hide-indent-bottom { margin-bottom: -5px; }
}
.buttoned-control-group {
z-index: 9999;
position: absolute;
right: 0;
}
.control-group {
margin-right: -5px;
& > * { margin-right: 5px; }
Expand Down