diff --git a/demo-app/src/app/button/button.component.html b/demo-app/src/app/button/button.component.html
index 47970b2a..affd439c 100644
--- a/demo-app/src/app/button/button.component.html
+++ b/demo-app/src/app/button/button.component.html
@@ -73,15 +73,15 @@
Flat button
-
+
- The button has a flat elevation with flat
property
+ The link has a flat elevation with flat
property
diff --git a/src/app/button/button.directive.ts b/src/app/button/button.directive.ts
index e853b20b..98e156b4 100644
--- a/src/app/button/button.directive.ts
+++ b/src/app/button/button.directive.ts
@@ -65,6 +65,9 @@ export class MzButtonDirective extends HandlePropChanges implements OnInit {
handleNoWaves() {
this.renderer.setElementClass(this.elementRef.nativeElement, 'waves-effect', !this.noWaves);
- this.renderer.setElementClass(this.elementRef.nativeElement, 'waves-light', !this.noWaves);
+
+ if (!this.flat) {
+ this.renderer.setElementClass(this.elementRef.nativeElement, 'waves-light', !this.noWaves);
+ }
}
}
diff --git a/src/app/button/button.directive.unit.spec.ts b/src/app/button/button.directive.unit.spec.ts
index 23661baf..3f6a5c6d 100644
--- a/src/app/button/button.directive.unit.spec.ts
+++ b/src/app/button/button.directive.unit.spec.ts
@@ -188,6 +188,19 @@ describe('MzButtonDirective:unit', () => {
]);
});
+ it('should add only waves-effect on button element when flat is true', () => {
+
+ const rendererSpy = spyOn(renderer, 'setElementClass');
+
+ directive.flat = true;
+ directive.handleNoWaves();
+
+ expect(rendererSpy.calls.count()).toBe(1);
+ expect(rendererSpy.calls.allArgs()).toEqual([
+ [mockElementRef.nativeElement, 'waves-effect', !directive.noWaves],
+ ]);
+ });
+
it('should not add waves-effect and waves-light on button element when noWaves is true', () => {
const rendererSpy = spyOn(renderer, 'setElementClass');