Skip to content

Commit

Permalink
Merge branch 'master' into style-fixes
Browse files Browse the repository at this point in the history
Conflicts:
	test/unit/styling-scoped-elements.html
	test/unit/styling-scoped.html

+ fix test on Safari that uses computed url style.
  • Loading branch information
Steven Orvell committed Feb 13, 2016
2 parents 5a493d8 + 605e5fe commit f8289fe
Show file tree
Hide file tree
Showing 43 changed files with 634 additions and 467 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules/*
bower_components/*
test/*
src/**/demo/*
src/**/experimental/*
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ addons:
before_script:
- npm install -g bower
- bower install
script:
- gulp lint
script:
- xvfb-run wct
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"
env:
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ gulp.task('release', function(cb) {
});

gulp.task('lint', function() {
return gulp.src('src/**/*.html')
return gulp.src(['src/**/*.html', 'test/unit/*.html'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
Expand Down
2 changes: 1 addition & 1 deletion src/lib/bind/accessors.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
var EFFECT_ORDER = {
'compute': 0,
'annotation': 1,
'computedAnnotation': 2,
'annotatedComputation': 2,
'reflect': 3,
'notify': 4,
'observer': 5,
Expand Down
13 changes: 7 additions & 6 deletions src/lib/style-properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@
if (m) {
p = this.valueForProperty(props[m[1]], props);
} else {
var pp = p.split(':');
if (pp[1]) {
pp[1] = pp[1].trim();
pp[1] = this.valueForProperty(pp[1], props) || pp[1];
var colon = p.indexOf(':');
if (colon !== -1) {
var pp = p.substring(colon);
pp = pp.trim();
pp = this.valueForProperty(pp, props) || pp;
p = p.substring(0, colon) + pp;
}
p = pp.join(':');
}
parts[i] = (p && p.lastIndexOf(';') === p.length - 1) ?
// strip trailing ;
Expand Down Expand Up @@ -443,7 +444,7 @@
// var(--a, --b)
// var(--a, fallback-literal)
// var(--a, fallback-literal(with-one-nested-parentheses))
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gi,
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,()]*)|(?:[^;()]*\([^;)]*\)))[\s]*?\)/gi,
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gi,
ANIMATION_MATCH: /(animation\s*:)|(animation-name\s*:)/,
IS_VAR: /^--/,
Expand Down
2 changes: 1 addition & 1 deletion src/standard/x-styling.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@

_scopeElementClass: function(element, selector) {
if (!nativeShadow && !this._scopeCssViaAttr) {
selector += (selector ? ' ' : '') + SCOPE_NAME + ' ' + this.is +
selector = (selector ? selector + ' ' : '') + SCOPE_NAME + ' ' + this.is +
(element._scopeSelector ? ' ' + XSCOPE_NAME + ' ' +
element._scopeSelector : '');
}
Expand Down
3 changes: 3 additions & 0 deletions test/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
assets/*
compat/*
smoke/*
10 changes: 10 additions & 0 deletions test/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"env": {
"mocha": true
},
"globals": {
"assert": true,
"sinon": true,
"WCT": true
}
}
16 changes: 8 additions & 8 deletions test/unit/array-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
</template>

<script>
/* global bind observer singleBound multiBound */
suite('basic', function() {

test('single selection', function() {
var el = singleConfigured;
var el = document.querySelector('#singleConfigured');
// Nothing selected
assert.strictEqual(el.selectedItem, null);
assert.isFalse(el.isSelected(el.items[0]));
Expand Down Expand Up @@ -76,7 +76,7 @@
});

test('multiple selection', function() {
var el = multiConfigured;
var el = document.querySelector('#multiConfigured');
// Nothing selected
assert.sameMembers(el.selected, []);
assert.isFalse(el.isSelected(el.items[0]));
Expand Down Expand Up @@ -143,7 +143,7 @@
};
singleBound.select(bind.items[2]);
assert.equal(called, true);
observer.singleChanged = function(info) {};
observer.singleChanged = function() {};
});

test('single selection sub-property change', function() {
Expand All @@ -156,7 +156,7 @@
};
bind.set(['items', 2, 'name'], 'test');
assert.equal(called, true);
observer.singleChanged = function(info) {};
observer.singleChanged = function() {};
});

test('single selection sub-property change after unshift', function() {
Expand All @@ -170,7 +170,7 @@
bind.unshift('items', {name: 'zero'});
bind.set(['items', 3, 'name'], 'test2');
assert.equal(called, true);
observer.singleChanged = function(info) {};
observer.singleChanged = function() {};
});

test('multi selection notification', function() {
Expand Down Expand Up @@ -210,7 +210,7 @@
};
multiBound.select(bind.items[0]);
assert.equal(called, true);
observer.multiChanged = function(info) {};
observer.multiChanged = function() {};
});

test('multi selection sub-property change', function() {
Expand All @@ -230,7 +230,7 @@
};
bind.set(['items', 0, 'name'], 'test2');
assert.equal(called, true);
observer.multiChanged = function(info) {};
observer.multiChanged = function() {};
});


Expand Down
6 changes: 3 additions & 3 deletions test/unit/async.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<body>

<script>

/* global Async */
setup(function() {
window.Async = Polymer.Async;
});
Expand Down Expand Up @@ -191,7 +191,7 @@
called3++;
};
var h1 = Async.run(callback1);
var h2 = Async.run(callback2);
var h2 = Async.run(callback2); //eslint-disable-line no-unused-vars
var h3 = Async.run(callback3);
Async.cancel(h1);
Async.cancel(h3);
Expand Down Expand Up @@ -306,7 +306,7 @@
called3++;
};
var h1 = Async.run(callback1, 50);
var h2 = Async.run(callback2, 50);
var h2 = Async.run(callback2, 50); //eslint-disable-line no-unused-vars
var h3 = Async.run(callback3, 200);
Async.cancel(h1);
Async.cancel(h3);
Expand Down
64 changes: 32 additions & 32 deletions test/unit/attached-style-elements.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<dom-module id="attached-style">
<style>
:host {
display: block;
box-sizing: border-box;
border: 1px solid black;
height: 100px;
}
</style>
<template>Hi</template>
<script>
Polymer({

is: 'attached-style',

attached: function() {
this.offsetParentAtAttachedTime = this.offsetParent;
this.offsetHeightAtAttachedTime = this.offsetHeight;
}

});
</script>
</dom-module>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<dom-module id="attached-style">
<style>
:host {
display: block;
box-sizing: border-box;
border: 1px solid black;
height: 100px;
}
</style>
<template>Hi</template>
<script>
Polymer({

is: 'attached-style',

attached: function() {
this.offsetParentAtAttachedTime = this.offsetParent;
this.offsetHeightAtAttachedTime = this.offsetHeight;
}

});
</script>
</dom-module>
8 changes: 4 additions & 4 deletions test/unit/attributes-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@
propChangedCount: 0,
attr1ChangedCount: 0,

propChanged: function(prop) {
propChanged: function() {
this.propChangedCount++;
},

attr1Changed: function(prop) {
attr1Changed: function() {
this.attr1ChangedCount++;
}

});
</script>

Expand Down Expand Up @@ -154,4 +154,4 @@
this.setAttribute('prop2', 'hi');
}
});
</script>
</script>
1 change: 1 addition & 0 deletions test/unit/attributes.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
</x-reflect>

<script>
/* global basicDefault basicConfigured compose reflectDefault reflectConfigured */

var configuredObject = {foo: 'bar', nested: {'meaning': 42}, arr: [0, 'foo', true]};
var configuredArray = [0, 'foo', true, {foo: 'bar'}];
Expand Down
1 change: 1 addition & 0 deletions test/unit/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

setup(function() {
// Ensure a clean environment for each test.
/* global Base */
window.Base = Polymer.Base;
window.Child = Object.create(Base);
Child._registerFeatures = function() {};
Expand Down
4 changes: 2 additions & 2 deletions test/unit/behaviors-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

overridablePropertyB: {
value: true
},
}

},

Expand All @@ -102,7 +102,7 @@
_simpleProperty: 'B',

_disabledChanged: function(disabled) {
this.__disabled = disabled
this.__disabled = disabled;
},

ready: function() {
Expand Down
90 changes: 90 additions & 0 deletions test/unit/bind-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -492,3 +492,93 @@
});
</script>
</dom-module>

<dom-module id="x-order-of-effects-grand-parent">
<template>
<x-order-of-effects id="child" base="{{base}}"></x-order-of-effects>
</template>
</dom-module>

<dom-module id="x-order-of-effects">
<template>
<x-order-of-effects-child
prop1="[[base]]"
prop2="[[_computedAnnotation(base)]]"
></x-order-of-effects-child>
</template>
<script>
(function() {
var invocations = [];
Polymer({
is: 'x-order-of-effects-grand-parent',
properties: {
base: {
observer: '_childPropertyChanged'
}
},
_childPropertyChanged: function() {
invocations.push('notify');
}
});
Polymer({
is: 'x-order-of-effects',
properties: {
base: {
type: String,
observer: '_observer',
notify: true,
reflectToAttribute: true
},
computed: {
type: String,
computed: '_computed(base)'
},
complex: {
type: String,
value: 'complex'
}
},
observers: ['_complexObserver(complex, base)'],
ready: function() {
this.invocations = invocations;

var old = this.reflectPropertyToAttribute.bind(this);
this.reflectPropertyToAttribute = function(property, attribute, value) {
invocations.push('reflect');
old(property, attribute, value);
};
},
_computed: function(base) {
invocations.push('compute');
return base;
},
_computedAnnotation: function(base) {
return base;
},
_observer: function() {
invocations.push('observer');
},
_complexObserver: function() {
invocations.push('complexObserver');
}
});
Polymer({
is: 'x-order-of-effects-child',
properties: {
prop1: {
observer: '_prop1Changed'
},
prop2: {
observer: '_prop2Changed'
}
},
_prop1Changed: function() {
invocations.push('annotation');
},
_prop2Changed: function() {
invocations.push('annotatedComputation');
}
});
})();
</script>
</dom-module>
Loading

0 comments on commit f8289fe

Please sign in to comment.