feat(buttons): dynamically add button attributes

Closes #5186
This commit is contained in:
Adam Bradley
2016-03-04 23:41:32 -06:00
parent 7b14a29ea7
commit 154a69c88a
8 changed files with 132 additions and 26 deletions

View File

@@ -179,7 +179,7 @@ export function run() {
});
function mockButton(attrs, config) {
function mockButton(attrs?, config?) {
config = config || new Config();
let elementRef = {
nativeElement: document.createElement('button')
@@ -189,12 +189,14 @@ export function run() {
elementRef.nativeElement.setAttribute(attrs[i], '');
}
}
let renderer = {
let renderer: any = {
setElementClass: function(nativeElement, className, shouldAdd) {
nativeElement.classList[shouldAdd ? 'add' : 'remove'](className);
}
};
return new Button(config, elementRef, renderer, null);
let b = new Button(config, elementRef, renderer, null);
b._init = true;
return b;
}
function hasClass(button, className) {