mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-06 00:45:09 +00:00
Remove unused files from scss directory
This commit is contained in:
@@ -1,87 +0,0 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngdoc module
|
||||
* @name material.components.button
|
||||
* @description
|
||||
*
|
||||
* Button
|
||||
*/
|
||||
angular.module('material.components.button', [
|
||||
'material.core'
|
||||
])
|
||||
.directive('mdButton', MdButtonDirective);
|
||||
|
||||
/**
|
||||
* @ngdoc directive
|
||||
* @name mdButton
|
||||
* @module material.components.button
|
||||
*
|
||||
* @restrict E
|
||||
*
|
||||
* @description
|
||||
* `<md-button>` is a button directive with optional ink ripples (default enabled).
|
||||
*
|
||||
* If you supply a `href` or `ng-href` attribute, it will become an `<a>` element. Otherwise, it will
|
||||
* become a `<button>` element.
|
||||
*
|
||||
* @param {boolean=} md-no-ink If present, disable ripple ink effects.
|
||||
* @param {expression=} ng-disabled En/Disable based on the expression
|
||||
* @param {string=} aria-label Adds alternative text to button for accessibility, useful for icon buttons.
|
||||
* If no default text is found, a warning will be logged.
|
||||
*
|
||||
* @usage
|
||||
* <hljs lang="html">
|
||||
* <md-button>
|
||||
* Button
|
||||
* </md-button>
|
||||
* <md-button href="http://google.com" class="md-button-colored">
|
||||
* I'm a link
|
||||
* </md-button>
|
||||
* <md-button ng-disabled="true" class="md-colored">
|
||||
* I'm a disabled button
|
||||
* </md-button>
|
||||
* </hljs>
|
||||
*/
|
||||
function MdButtonDirective($mdInkRipple, $mdTheming, $mdAria) {
|
||||
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
template: getTemplate,
|
||||
link: postLink
|
||||
};
|
||||
|
||||
function isAnchor(attr) {
|
||||
return angular.isDefined(attr.href) || angular.isDefined(attr.ngHref);
|
||||
}
|
||||
|
||||
function getTemplate(element, attr) {
|
||||
return isAnchor(attr) ?
|
||||
'<a class="md-button" ng-transclude></a>' :
|
||||
'<button class="md-button" ng-transclude></button>';
|
||||
}
|
||||
|
||||
function postLink(scope, element, attr) {
|
||||
var node = element[0];
|
||||
$mdTheming(element);
|
||||
$mdInkRipple.attachButtonBehavior(scope, element);
|
||||
|
||||
var elementHasText = node.textContent.trim();
|
||||
if (!elementHasText) {
|
||||
$mdAria.expect(element, 'aria-label');
|
||||
}
|
||||
|
||||
// For anchor elements, we have to set tabindex manually when the
|
||||
// element is disabled
|
||||
if (isAnchor(attr) && angular.isDefined(attr.ngDisabled) ) {
|
||||
scope.$watch(attr.ngDisabled, function(isDisabled) {
|
||||
element.attr('tabindex', isDisabled ? -1 : 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})();
|
||||
@@ -1,91 +0,0 @@
|
||||
describe('md-button', function() {
|
||||
|
||||
beforeEach(TestUtil.mockRaf);
|
||||
beforeEach(module('material.components.button'));
|
||||
|
||||
it('should convert attributes on an md-button to attributes on the generated button', inject(function($compile, $rootScope) {
|
||||
var button = $compile('<md-button hide hide-sm></md-button>')($rootScope);
|
||||
$rootScope.$apply();
|
||||
expect(button[0].hasAttribute('hide')).toBe(true);
|
||||
expect(button[0].hasAttribute('hide-sm')).toBe(true);
|
||||
}));
|
||||
|
||||
it('should only have one ripple container when a custom ripple color is set', inject(function ($compile, $rootScope, $timeout) {
|
||||
var button = $compile('<md-button md-ink-ripple="#f00">button</md-button>')($rootScope);
|
||||
var scope = button.eq(0).scope();
|
||||
scope._onInput({ isFirst: true, eventType: Hammer.INPUT_START, center: { x: 0, y: 0 } });
|
||||
expect(button[0].getElementsByClassName('md-ripple-container').length).toBe(1);
|
||||
}));
|
||||
|
||||
|
||||
it('should expect an aria-label if element has no text', inject(function($compile, $rootScope, $log) {
|
||||
spyOn($log, 'warn');
|
||||
var button = $compile('<md-button><md-icon></md-icon></md-button>')($rootScope);
|
||||
$rootScope.$apply();
|
||||
expect($log.warn).toHaveBeenCalled();
|
||||
|
||||
$log.warn.reset();
|
||||
button = $compile('<md-button aria-label="something"><md-icon></md-icon></md-button>')($rootScope);
|
||||
$rootScope.$apply();
|
||||
expect($log.warn).not.toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
|
||||
describe('with href or ng-href', function() {
|
||||
|
||||
it('should be anchor if href attr', inject(function($compile, $rootScope) {
|
||||
var button = $compile('<md-button href="/link">')($rootScope.$new());
|
||||
$rootScope.$apply();
|
||||
expect(button[0].tagName.toLowerCase()).toEqual('a');
|
||||
}));
|
||||
|
||||
it('should be anchor if ng-href attr', inject(function($compile, $rootScope) {
|
||||
var button = $compile('<md-button ng-href="/link">')($rootScope.$new());
|
||||
$rootScope.$apply();
|
||||
expect(button[0].tagName.toLowerCase()).toEqual('a');
|
||||
}));
|
||||
|
||||
it('should be button otherwise', inject(function($compile, $rootScope) {
|
||||
var button = $compile('<md-button>')($rootScope.$new());
|
||||
$rootScope.$apply();
|
||||
expect(button[0].tagName.toLowerCase()).toEqual('button');
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('with ng-disabled', function() {
|
||||
|
||||
it('should not set `tabindex` when used without anchor attributes', inject(function ($compile, $rootScope, $timeout) {
|
||||
var scope = angular.extend( $rootScope.$new(), { isDisabled : true } );
|
||||
var button = $compile('<md-button ng-disabled="isDisabled">button</md-button>')(scope);
|
||||
$rootScope.$apply();
|
||||
|
||||
expect(button[0].hasAttribute('tabindex')).toBe(false);
|
||||
}));
|
||||
|
||||
it('should set `tabindex == -1` when used with href', inject(function ($compile, $rootScope, $timeout) {
|
||||
var scope = angular.extend( $rootScope.$new(), { isDisabled : true } );
|
||||
var button = $compile('<md-button ng-disabled="isDisabled" href="#nowhere">button</md-button>')(scope);
|
||||
|
||||
$rootScope.$apply();
|
||||
expect(button.attr('tabindex')).toBe("-1");
|
||||
|
||||
$rootScope.$apply(function(){
|
||||
scope.isDisabled = false;
|
||||
});
|
||||
expect(button.attr('tabindex')).toBe("0");
|
||||
|
||||
}));
|
||||
|
||||
it('should set `tabindex == -1` when used with ng-href', inject(function ($compile, $rootScope, $timeout) {
|
||||
var scope = angular.extend( $rootScope.$new(), { isDisabled : true, url : "http://material.angularjs.org" });
|
||||
var button = $compile('<md-button ng-disabled="isDisabled" ng-href="url">button</md-button>')(scope);
|
||||
$rootScope.$apply();
|
||||
|
||||
expect(button.attr('tabindex')).toBe("-1");
|
||||
}));
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
@@ -1,53 +0,0 @@
|
||||
|
||||
<div ng-controller="AppCtrl">
|
||||
<md-content >
|
||||
|
||||
<section layout="row" layout-sm="column" layout-align="center center">
|
||||
<md-button>{{title1}}</md-button>
|
||||
<md-button md-no-ink class="md-primary">Primary (md-noink)</md-button>
|
||||
<md-button ng-disabled="true" class="md-primary">Disabled</md-button>
|
||||
<md-button class="md-warn">{{title4}}</md-button>
|
||||
</section>
|
||||
|
||||
<section layout="row" layout-sm="column" layout-align="center center">
|
||||
<md-button class="md-raised">Button</md-button>
|
||||
<md-button class="md-raised md-primary">Primary</md-button>
|
||||
<md-button ng-disabled="true" class="md-raised md-primary">Disabled</md-button>
|
||||
<md-button class="md-raised md-warn">Warn</md-button>
|
||||
<div class="label">raised</div>
|
||||
</section>
|
||||
|
||||
<section layout="row" layout-sm="column" layout-align="center center">
|
||||
<md-button class="md-fab" aria-label="Time">
|
||||
<md-icon icon="/img/icons/ic_access_time_24px.svg" style="width: 24px; height: 24px;"></md-icon>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-fab" aria-label="New document">
|
||||
<md-icon icon="/img/icons/ic_insert_drive_file_24px.svg" style="width: 24px; height: 24px;"></md-icon>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-fab" ng-disabled="true" aria-label="Comment">
|
||||
<md-icon icon="/img/icons/ic_comment_24px.svg" style="width: 24px; height: 24px;"></md-icon>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-fab md-primary" md-theme="cyan" aria-label="Profile">
|
||||
<md-icon icon="/img/icons/ic_people_24px.svg" style="width: 24px; height: 24px;"></md-icon>
|
||||
</md-button>
|
||||
<div class="label">FAB</div>
|
||||
</section>
|
||||
|
||||
<section layout="row" layout-sm="column" layout-align="center center">
|
||||
<md-button ng-href="{{googleUrl}}" target="_blank">Go to Google</md-button>
|
||||
<md-button>RSVP</md-button>
|
||||
</section>
|
||||
|
||||
<section layout="row" layout-sm="column" layout-align="center center">
|
||||
<md-button class="md-primary md-hue-1">Primary Hue 1</md-button>
|
||||
<md-button class="md-warn md-raised md-hue-2">Warn Hue 2</md-button>
|
||||
<md-button class="md-accent">Accent</md-button>
|
||||
<md-button class="md-accent md-raised md-hue-3">Accent Hue 3</md-button>
|
||||
<div class="label">Themed</div>
|
||||
</section>
|
||||
|
||||
</md-content>
|
||||
</div>
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
angular.module('buttonsDemo1', ['ngMaterial'])
|
||||
|
||||
.controller('AppCtrl', function($scope) {
|
||||
$scope.title1 = 'Button';
|
||||
$scope.title4 = 'Warn';
|
||||
$scope.isDisabled = true;
|
||||
|
||||
$scope.googleUrl = 'http://google.com';
|
||||
|
||||
});
|
||||
@@ -1,30 +0,0 @@
|
||||
|
||||
/** From vulcanized demo **/
|
||||
|
||||
section {
|
||||
background: #f7f7f7;
|
||||
border-radius: 3px;
|
||||
text-align: center;
|
||||
margin: 1em;
|
||||
position: relative !important;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
md-content {
|
||||
margin-right: 7px;
|
||||
}
|
||||
section .md-button:not(.md-fab) {
|
||||
min-width: 10em;
|
||||
}
|
||||
section .md-button {
|
||||
display: block;
|
||||
margin: 1em;
|
||||
line-height: 25px;
|
||||
}
|
||||
.label {
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
left: 7px;
|
||||
color: #ccc;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user