diff --git a/src/components/datepicker/js/datepickerDirective.js b/src/components/datepicker/js/datepickerDirective.js index 9c192deffd2..decdaf96fb3 100644 --- a/src/components/datepicker/js/datepickerDirective.js +++ b/src/components/datepicker/js/datepickerDirective.js @@ -64,6 +64,7 @@ // interaction on the text input, and multiple tab stops for one component (picker) // may be confusing. var hiddenIcons = tAttrs.mdHideIcons; + var ariaLabelValue = tAttrs.ariaLabel || tAttrs.mdPlaceholder; var calendarButton = (hiddenIcons === 'all' || hiddenIcons === 'calendar') ? '' : '' + ''; - return '' + - calendarButton + - '
' + - '' + - triangleButton + + return calendarButton + + '
' + + ' ' + + triangleButton + '
' + // This pane will be detached from here and re-attached to the document body. diff --git a/src/components/datepicker/js/datepickerDirective.spec.js b/src/components/datepicker/js/datepickerDirective.spec.js index ab6551dfecb..b00505e2bb6 100644 --- a/src/components/datepicker/js/datepickerDirective.spec.js +++ b/src/components/datepicker/js/datepickerDirective.spec.js @@ -98,6 +98,11 @@ describe('md-datepicker', function() { expect(controller.inputElement.placeholder).toBe('Fancy new placeholder'); }); + it('should forward the aria-label to the generated input', function() { + createDatepickerInstance(''); + expect(controller.ngInputElement.attr('aria-label')).toBe('Enter a date'); + }); + it('should throw an error when the model is not a date', function() { expect(function() { pageScope.myDate = '2015-01-01';