Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 6dfe407

Browse files
committed
chore: normalize line endings
- This adds the necessary files (.gitattributes and .editorconfig) to ensure line endings use lf
1 parent 2647e0f commit 6dfe407

File tree

6 files changed

+82
-58
lines changed

6 files changed

+82
-58
lines changed

Diff for: .editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
# Tabs in JS unless otherwise specified
13+
[**.js]
14+
indent_style = space
15+
indent_size = 2
16+
17+
[*.md]
18+
trim_trailing_whitespace = false

Diff for: .gitattributes

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.html eol=lf
2+
*.css eol=lf
3+
*.js eol=lf
4+
*.md eol=lf
5+
*.json eol=lf
6+
*.yml eol=lf

Diff for: dist/select.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -2038,15 +2038,15 @@ uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinE
20382038
// When using (key,value) ui-select requires filters to be extracted, since the object
20392039
// is converted to an array for $select.items
20402040
// (in which case the filters need to be reapplied)
2041-
if (match[3]) {
2042-
// Remove any enclosing parenthesis
2043-
source = match[5].replace(/(^\()|(\)$)/g, '');
2044-
// match all after | but not after ||
2045-
var filterMatch = match[5].match(/^\s*(?:[\s\S]+?)(?:[^\|]|\|\|)+([\s\S]*)\s*$/);
2046-
if(filterMatch && filterMatch[1].trim()) {
2047-
filters = filterMatch[1];
2048-
source = source.replace(filters, '');
2049-
}
2041+
if (match[3]) {
2042+
// Remove any enclosing parenthesis
2043+
source = match[5].replace(/(^\()|(\)$)/g, '');
2044+
// match all after | but not after ||
2045+
var filterMatch = match[5].match(/^\s*(?:[\s\S]+?)(?:[^\|]|\|\|)+([\s\S]*)\s*$/);
2046+
if(filterMatch && filterMatch[1].trim()) {
2047+
filters = filterMatch[1];
2048+
source = source.replace(filters, '');
2049+
}
20502050
}
20512051

20522052
return {

Diff for: src/uiSelectMatchDirective.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ uis.directive('uiSelectMatch', ['uiSelectConfig', function(uiSelectConfig) {
3535
}
3636
};
3737

38-
function getAttribute(elem, attribute) {
39-
if (elem[0].hasAttribute(attribute))
40-
return elem.attr(attribute);
41-
42-
if (elem[0].hasAttribute('data-' + attribute))
43-
return elem.attr('data-' + attribute);
44-
45-
if (elem[0].hasAttribute('x-' + attribute))
46-
return elem.attr('x-' + attribute);
38+
function getAttribute(elem, attribute) {
39+
if (elem[0].hasAttribute(attribute))
40+
return elem.attr(attribute);
41+
42+
if (elem[0].hasAttribute('data-' + attribute))
43+
return elem.attr('data-' + attribute);
44+
45+
if (elem[0].hasAttribute('x-' + attribute))
46+
return elem.attr('x-' + attribute);
4747
}
4848
}]);

Diff for: src/uisRepeatParserService.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinE
4747
// When using (key,value) ui-select requires filters to be extracted, since the object
4848
// is converted to an array for $select.items
4949
// (in which case the filters need to be reapplied)
50-
if (match[3]) {
51-
// Remove any enclosing parenthesis
52-
source = match[5].replace(/(^\()|(\)$)/g, '');
53-
// match all after | but not after ||
54-
var filterMatch = match[5].match(/^\s*(?:[\s\S]+?)(?:[^\|]|\|\|)+([\s\S]*)\s*$/);
55-
if(filterMatch && filterMatch[1].trim()) {
56-
filters = filterMatch[1];
57-
source = source.replace(filters, '');
58-
}
50+
if (match[3]) {
51+
// Remove any enclosing parenthesis
52+
source = match[5].replace(/(^\()|(\)$)/g, '');
53+
// match all after | but not after ||
54+
var filterMatch = match[5].match(/^\s*(?:[\s\S]+?)(?:[^\|]|\|\|)+([\s\S]*)\s*$/);
55+
if(filterMatch && filterMatch[1].trim()) {
56+
filters = filterMatch[1];
57+
source = source.replace(filters, '');
58+
}
5959
}
6060

6161
return {

Diff for: test/select.spec.js

+31-31
Original file line numberDiff line numberDiff line change
@@ -412,21 +412,21 @@ describe('ui-select tests', function() {
412412
expect(getMatchLabel(el)).toEqual('Samantha');
413413
});
414414

415-
it('should correctly render initial state with track by $index', function () {
416-
417-
var el = compileTemplate(
418-
'<ui-select ng-model="selection.selected"> \
419-
<ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
420-
<ui-select-choices repeat="person in people track by $index"> \
421-
{{person.email}} \
422-
</ui-select-choices> \
423-
</ui-select>'
424-
);
425-
426-
openDropdown(el);
427-
428-
var generatedId = el.scope().$select.generatedId;
429-
expect($(el).find('[id="ui-select-choices-row-' + generatedId + '-0"]').length).toEqual(1);
415+
it('should correctly render initial state with track by $index', function () {
416+
417+
var el = compileTemplate(
418+
'<ui-select ng-model="selection.selected"> \
419+
<ui-select-match placeholder="Pick one...">{{$select.selected.name}}</ui-select-match> \
420+
<ui-select-choices repeat="person in people track by $index"> \
421+
{{person.email}} \
422+
</ui-select-choices> \
423+
</ui-select>'
424+
);
425+
426+
openDropdown(el);
427+
428+
var generatedId = el.scope().$select.generatedId;
429+
expect($(el).find('[id="ui-select-choices-row-' + generatedId + '-0"]').length).toEqual(1);
430430
});
431431

432432
it('should utilize wrapper directive ng-model', function() {
@@ -1607,42 +1607,42 @@ describe('ui-select tests', function() {
16071607
expect(el.find('.ui-select-match-item').length).toBe(0);
16081608
});
16091609

1610-
it('should render intial state with data-multiple attribute', function () {
1611-
// ensure match template has been loaded by having more than one selection
1612-
scope.selection.selectedMultiple = [scope.people[0], scope.people[1]];
1613-
1610+
it('should render intial state with data-multiple attribute', function () {
1611+
// ensure match template has been loaded by having more than one selection
1612+
scope.selection.selectedMultiple = [scope.people[0], scope.people[1]];
1613+
16141614
var el = compileTemplate(
16151615
'<ui-select data-multiple ng-model="selection.selectedMultiple" theme="bootstrap" style="width: 800px;"> \
16161616
<ui-select-match placeholder="Pick one...">{{$item.name}} &lt;{{$item.email}}&gt;</ui-select-match> \
16171617
<ui-select-choices repeat="person in people | filter: $select.search"> \
16181618
<div ng-bind-html="person.name | highlight: $select.search"></div> \
16191619
<div ng-bind-html="person.email | highlight: $select.search"></div> \
16201620
</ui-select-choices> \
1621-
</ui-select>'
1622-
);
1623-
1621+
</ui-select>'
1622+
);
1623+
16241624
expect(el).toHaveClass('ui-select-multiple');
16251625
expect(el.scope().$select.selected.length).toBe(2);
1626-
expect(el.find('.ui-select-match-item').length).toBe(2);
1626+
expect(el.find('.ui-select-match-item').length).toBe(2);
16271627
});
16281628

1629-
it('should render intial state with x-multiple attribute', function () {
1630-
// ensure match template has been loaded by having more than one selection
1631-
scope.selection.selectedMultiple = [scope.people[0], scope.people[1]];
1632-
1629+
it('should render intial state with x-multiple attribute', function () {
1630+
// ensure match template has been loaded by having more than one selection
1631+
scope.selection.selectedMultiple = [scope.people[0], scope.people[1]];
1632+
16331633
var el = compileTemplate(
16341634
'<ui-select x-multiple ng-model="selection.selectedMultiple" theme="bootstrap" style="width: 800px;"> \
16351635
<ui-select-match placeholder="Pick one...">{{$item.name}} &lt;{{$item.email}}&gt;</ui-select-match> \
16361636
<ui-select-choices repeat="person in people | filter: $select.search"> \
16371637
<div ng-bind-html="person.name | highlight: $select.search"></div> \
16381638
<div ng-bind-html="person.email | highlight: $select.search"></div> \
16391639
</ui-select-choices> \
1640-
</ui-select>'
1641-
);
1642-
1640+
</ui-select>'
1641+
);
1642+
16431643
expect(el).toHaveClass('ui-select-multiple');
16441644
expect(el.scope().$select.selected.length).toBe(2);
1645-
expect(el.find('.ui-select-match-item').length).toBe(2);
1645+
expect(el.find('.ui-select-match-item').length).toBe(2);
16461646
});
16471647

16481648
it('should set model as an empty array if ngModel isnt defined after an item is selected', function () {

0 commit comments

Comments
 (0)