Skip to content

Commit 2239eb0

Browse files
Merge pull request #78 from angular/master
Update upstream
2 parents d44f457 + 84294ec commit 2239eb0

File tree

5 files changed

+105
-11
lines changed

5 files changed

+105
-11
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
'use strict';
2+
3+
describe('directives', function() {
4+
5+
describe('parameter section', function() {
6+
7+
it('should show the directive name only if it is a param (attribute) with a value', function() {
8+
browser.get('build/docs/index.html#!/api/ng/directive/ngInclude');
9+
expect(getParamNames().getText()).toContain('ngInclude | src');
10+
11+
browser.get('build/docs/index.html#!/api/ngRoute/directive/ngView');
12+
expect(getParamNames().getText()).not.toContain('ngView');
13+
});
14+
});
15+
16+
describe('usage section', function() {
17+
18+
it('should show the directive name if it is a param (attribute) with a value', function() {
19+
browser.get('build/docs/index.html#!/api/ng/directive/ngInclude');
20+
21+
expect(getUsageAs('element', 'ng-include').isPresent()).toBe(true);
22+
expect(getUsageAs('attribute', 'ng-include').isPresent()).toBe(true);
23+
expect(getUsageAs('CSS class', 'ng-include').isPresent()).toBe(true);
24+
});
25+
26+
it('should show the directive name if it is a void param (attribute)', function() {
27+
browser.get('build/docs/index.html#!/api/ngRoute/directive/ngView');
28+
29+
expect(getUsageAs('element', 'ng-view').isPresent()).toBe(true);
30+
expect(getUsageAs('attribute', 'ng-view').isPresent()).toBe(true);
31+
expect(getUsageAs('CSS class', 'ng-view').isPresent()).toBe(true);
32+
});
33+
});
34+
});
35+
36+
function getParamNames() {
37+
var argsSection = element(by.className('input-arguments'));
38+
39+
var paramNames = argsSection.all(by.css('tr td:nth-child(1)'));
40+
41+
return paramNames;
42+
}
43+
44+
// Based on the type of directive usage, the directive name will show up in the code block
45+
// with a specific class
46+
var typeClassMap = {
47+
element: 'tag',
48+
attribute: 'atn',
49+
'CSS class': 'atv'
50+
};
51+
52+
function getUsageAs(type, directiveName) {
53+
var usage = element(by.className('usage'));
54+
55+
var as = usage.element(by.cssContainingText('li', 'as ' + type));
56+
57+
return as.element(by.cssContainingText('span.' + typeClassMap[type], directiveName));
58+
}

docs/config/templates/ngdoc/api/directive.template.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,23 @@ <h2 id="usage">Usage</h2>
2929
</li>
3030
{% endif -%}
3131

32+
33+
{% set hasNameAsParam = false %}
34+
35+
{# when a directive's name is not a parameter (i.e. doesn't take a value),
36+
add the directive name to the list of attributes and/or css classes #}
37+
38+
{%- for param in doc.params %}
39+
{% set hasNameAsParam = true if param.name === doc.name else hasNameAsParam %}
40+
{%- endfor %}
41+
3242
{%- if doc.restrict.attribute -%}
3343
<li>as attribute:
3444
{% code %}
3545
<{$ doc.element $}
46+
{%- if not hasNameAsParam %}
47+
{$ lib.directiveParam(doc.name, {}, '', '') $}
48+
{%- endif -%}
3649
{%- for param in doc.params %}
3750
{$ lib.directiveParam(param.name, param.type, '="', '"') $}
3851
{%- endfor %}>
@@ -43,10 +56,14 @@ <h2 id="usage">Usage</h2>
4356
{% endif -%}
4457

4558
{%- if doc.restrict.cssClass -%}
59+
4660
<li>as CSS class:
4761
{% code %}
4862
{% set sep = joiner(' ') %}
4963
<{$ doc.element $} class="
64+
{%- if not hasNameAsParam -%}
65+
{$ sep() $}{$ lib.directiveParam(doc.name, {}, '', '') $}
66+
{%- endif -%}
5067
{%- for param in doc.params -%}
5168
{$ sep() $}{$ lib.directiveParam(param.name, param.type, ': ', ';') $}
5269
{%- endfor %}"> ... </{$ doc.element $}>

karma-shared.conf.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,22 @@ module.exports = function(config, specificOptions) {
4545
'SL_Chrome': {
4646
base: 'SauceLabs',
4747
browserName: 'chrome',
48-
version: '59'
48+
version: 'latest'
49+
},
50+
'SL_Chrome-1': {
51+
base: 'SauceLabs',
52+
browserName: 'chrome',
53+
version: 'latest-1'
4954
},
5055
'SL_Firefox': {
5156
base: 'SauceLabs',
5257
browserName: 'firefox',
53-
version: '54'
58+
version: 'latest'
59+
},
60+
'SL_Firefox-1': {
61+
base: 'SauceLabs',
62+
browserName: 'firefox',
63+
version: 'latest-1'
5464
},
5565
'SL_Safari_8': {
5666
base: 'SauceLabs',
@@ -86,7 +96,13 @@ module.exports = function(config, specificOptions) {
8696
base: 'SauceLabs',
8797
browserName: 'microsoftedge',
8898
platform: 'Windows 10',
89-
version: '14'
99+
version: 'latest'
100+
},
101+
'SL_EDGE-1': {
102+
base: 'SauceLabs',
103+
browserName: 'microsoftedge',
104+
platform: 'Windows 10',
105+
version: 'latest-1'
90106
},
91107
'SL_iOS': {
92108
base: 'SauceLabs',
@@ -137,7 +153,6 @@ module.exports = function(config, specificOptions) {
137153
'BS_EDGE': {
138154
base: 'BrowserStack',
139155
browser: 'edge',
140-
browser_version: '14',
141156
os: 'Windows',
142157
os_version: '10'
143158
},

scripts/travis/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ case "$JOB" in
2121
if [ "$BROWSER_PROVIDER" == "browserstack" ]; then
2222
BROWSERS="BS_Chrome,BS_Safari,BS_Firefox,BS_IE_9,BS_IE_10,BS_IE_11,BS_EDGE,BS_iOS_8,BS_iOS_9"
2323
else
24-
BROWSERS="SL_Chrome,SL_Firefox,SL_Safari_8,SL_Safari_9,SL_IE_9,SL_IE_10,SL_IE_11,SL_EDGE,SL_iOS"
24+
BROWSERS="SL_Chrome,SL_Chrome-1,SL_Firefox,SL_Firefox-1,SL_Safari_8,SL_Safari_9,SL_IE_9,SL_IE_10,SL_IE_11,SL_EDGE,SL_EDGE-1,SL_iOS"
2525
fi
2626

2727
grunt test:promises-aplus
@@ -56,4 +56,4 @@ case "$JOB" in
5656
*)
5757
echo "Unknown job type. Please set JOB=ci-checks, JOB=unit, JOB=deploy or JOB=e2e-*."
5858
;;
59-
esac
59+
esac

yarn.lock

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5609,14 +5609,18 @@ semver-diff@^0.1.0:
56095609
dependencies:
56105610
semver "^2.2.1"
56115611

5612-
semver@*, "semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.1.0, semver@^5.2.0, semver@^5.3.0, semver@~5.3.0:
5613-
version "5.3.0"
5614-
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
5615-
56165612
"semver@2 || 3 || 4", semver@^4.1.0, semver@~4.3.3:
56175613
version "4.3.6"
56185614
resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da"
56195615

5616+
"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.1.0, semver@^5.2.0, semver@^5.3.0, semver@~5.3.0:
5617+
version "5.3.0"
5618+
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
5619+
5620+
5621+
version "2.2.1"
5622+
resolved "https://registry.yarnpkg.com/semver/-/semver-2.2.1.tgz#7941182b3ffcc580bff1c17942acdf7951c0d213"
5623+
56205624
semver@^2.2.1, semver@~2.3.0:
56215625
version "2.3.2"
56225626
resolved "https://registry.yarnpkg.com/semver/-/semver-2.3.2.tgz#b9848f25d6cf36333073ec9ef8856d42f1233e52"
@@ -6335,7 +6339,7 @@ traceur@vojtajina/traceur-compiler#add-es6-pure-transformer-dist:
63356339
dependencies:
63366340
commander ">=1.1"
63376341
q-io "~1.10.6"
6338-
semver "*"
6342+
semver "2.2.1"
63396343

63406344
"traverse@>=0.3.0 <0.4":
63416345
version "0.3.9"

0 commit comments

Comments
 (0)