Cleanup modulizer conversion leftovers (#5347)

This commit is contained in:
Serhii Kulykov
2018-09-06 13:07:57 +03:00
committed by Tim van der Lippe
parent 0d35437c98
commit 448093b6dc
17 changed files with 102 additions and 121 deletions

View File

@@ -214,7 +214,7 @@ Polymer({
</div>
</template>
<script type="module">
import { Polymer, version as version$0 } from '../../lib/utils/boot.js';
import { Polymer, version } from '../../lib/utils/boot.js';
var params = document.location.search.substring(1).split('&').map(p=>p.split('='))
.reduce((m, p)=>{return m[p[0]] = p[1], m;}, {});
Polymer({
@@ -295,7 +295,7 @@ Polymer({
return value.toFixed(decimals);
},
ready: function() {
this.version = version$0 || 'alacarte';
this.version = version || 'alacarte';
if (!this.setProperties) {
this.setProperties = function(props) {
for (var p in props) {

View File

@@ -16,8 +16,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<body>
<script type="module">
import { PolymerElement } from '../../polymer-element.js';
import { html as html$0 } from '../../lib/utils/html-tag.js';
const html = html$0;
import { html } from '../../lib/utils/html-tag.js';
class SuperClass extends PolymerElement {
static get is() {return 'super-class';}
static get template() {
@@ -64,4 +64,4 @@ customElements.define(XString.is, XString);
<super-class></super-class>
<sub-class></sub-class>
<x-string></x-string>
</body>
</body>

View File

@@ -19,27 +19,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<body>
<script type="module">
import * as caseMap$0 from '../../lib/utils/case-map.js';
import { camelToDashCase, dashToCamelCase } from '../../lib/utils/case-map.js';
suite('case-map', function() {
var caseMap;
setup(function() {
caseMap = caseMap$0;
});
test('camelToDashCase converts to dashes', function() {
assert.equal(caseMap.camelToDashCase('camelCase'), 'camel-case');
assert.equal(caseMap.camelToDashCase('camelCCase'), 'camel-c-case');
assert.equal(camelToDashCase('camelCase'), 'camel-case');
assert.equal(camelToDashCase('camelCCase'), 'camel-c-case');
});
test('dashToCamelCase converts to camelCase', function() {
assert.equal(caseMap.dashToCamelCase('camel-case'), 'camelCase');
assert.equal(caseMap.dashToCamelCase('camel-c-case'), 'camelCCase');
assert.equal(dashToCamelCase('camel-case'), 'camelCase');
assert.equal(dashToCamelCase('camel-c-case'), 'camelCCase');
});
test('camelToDashCase and dashToCamelCase reverse the other function', function() {
var camelCase = caseMap.dashToCamelCase('camel-c-case');
assert.equal(caseMap.camelToDashCase(camelCase), 'camel-c-case');
var camelCase = dashToCamelCase('camel-c-case');
assert.equal(camelToDashCase(camelCase), 'camel-c-case');
});
});
</script>

View File

@@ -24,8 +24,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script type="module">
import './gestures-elements.js';
import { afterNextRender } from '../../lib/utils/render-status.js';
import * as gestures from '../../lib/utils/gestures.js';
import { resetMouseCanceller, deepTargetFind, recognizers as recognizers$0, addListener, removeListener } from '../../lib/utils/gestures.js';
import { resetMouseCanceller, deepTargetFind, recognizers, addListener, removeListener } from '../../lib/utils/gestures.js';
suite('simulate events', function() {
@@ -474,14 +473,14 @@ suite('Reference Cleanup', function() {
el.dispatchEvent(ev);
// some recognizers do not track the document, like tap
var recognizers = recognizers$0.filter(function(r) {
var recs = recognizers.filter(function(r) {
return r.info.hasOwnProperty('movefn') &&
r.info.hasOwnProperty('upfn');
});
assert.isAbove(recognizers.length, 0, 'some recognizers track the document');
assert.isAbove(recs.length, 0, 'some recognizers track the document');
recognizers.forEach(function(r) {
recs.forEach(function(r) {
assert.isFunction(r.info.movefn, r.name + ' movefn');
assert.isFunction(r.info.upfn, r.name + ' upfn');
});
@@ -489,7 +488,7 @@ suite('Reference Cleanup', function() {
ev = new CustomEvent('mouseup', {bubbles: true, composed: true});
el.dispatchEvent(ev);
recognizers.forEach(function(r) {
recs.forEach(function(r) {
assert.isNull(r.info.movefn, r.name + ' movefn');
assert.isNull(r.info.upfn, r.name + ' upfn');
});
@@ -509,7 +508,7 @@ suite('Imperative API', function() {
test('add listeners with addListener', function() {
addListener(el, 'down', fn);
gestures.add(el, 'up', fn);
addListener(el, 'up', fn);
var ev = new CustomEvent('mousedown', {bubbles: true, composed: true});
el.dispatchEvent(ev);
assert.equal(el.stream.length, 1);
@@ -521,7 +520,7 @@ suite('Imperative API', function() {
});
test('remove listeners with removeListener', function() {
gestures.remove(el, 'down', fn);
removeListener(el, 'down', fn);
removeListener(el, 'up', fn);
var ev = new CustomEvent('mousedown', {bubbles: true, composed: true});
el.dispatchEvent(ev);
@@ -548,20 +547,20 @@ suite('setScrollDirection', function() {
suite('Regression Testing', function() {
test('#4459', function() {
gestures.add(document, 'tap', null);
addListener(document, 'tap', null);
document.dispatchEvent(new MouseEvent('mousedown', { detail: 1, clientX: -100, bubbles: true, composed: true }));
document.dispatchEvent(new MouseEvent('mouseup', { detail: 1, clientX: 100, bubbles: true, composed: true }));
document.dispatchEvent(new MouseEvent('click', { detail: 1, clientX: 100, bubbles: true, composed: true }));
gestures.remove(document, 'tap', null);
removeListener(document, 'tap', null);
});
test('#5030', function() {
let count = 0;
const increment = function() { count++; };
gestures.add(window, 'tap', increment);
addListener(window, 'tap', increment);
window.dispatchEvent(new MouseEvent('click', {bubbles: true}));
assert.equal(count, 1);
gestures.remove(window, 'tap', increment);
removeListener(window, 'tap', increment);
});
suite('native label click', function() {
@@ -637,7 +636,7 @@ suite('Regression Testing', function() {
document.body.removeChild(div);
});
setup(function() {
gestures.resetMouseCanceller();
resetMouseCanceller();
});
test('click() function works as expected on disabled elements', function() {
@@ -695,7 +694,7 @@ suite('Regression Testing', function() {
target.dispatchEvent(touchend);
assert.deepEqual(el.taps, ['button#nested']);
gestures.resetMouseCanceller();
resetMouseCanceller();
// tap a custom element with a `disabled` property
target = el.$.disabledEl;

View File

@@ -20,7 +20,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<x-test></x-test>
<script type="module">
import { importHref as importHref$0 } from '../../lib/utils/import-href.js';
import { importHref } from '../../lib/utils/import-href.js';
import { PolymerElement } from '../../polymer-element.js';
import { Base } from '../../polymer-legacy.js';
@@ -30,7 +30,7 @@ suite('importHref', function() {
test('importing polymer via Polymer.importHref', function(done) {
assert.notOk(PolymerElement);
importHref$0('../../polymer.html', function() {
importHref('../../polymer.html', function() {
assert.ok(PolymerElement);
done();
});

View File

@@ -14,24 +14,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script src="../../node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
<script src="wct-browser-config.js"></script>
<script src="../../node_modules/wct-browser-legacy/browser.js"></script>
<script type="module" src="../../lib/utils/path.js"></script>
</head>
<body>
<script type="module">
import * as path from '../../lib/utils/path.js';
import { isDeep } from '../../lib/utils/path.js';
import { isAncestor, isDeep, isDescendant, root, matches, translate } from '../../lib/utils/path.js';
suite('path utilities', function() {
var Path;
setup(function() {
Path = path;
});
test('root()', function() {
assert.equal(Path.root('foo'), 'foo');
assert.equal(Path.root('foo.bar'), 'foo');
assert.equal(root('foo'), 'foo');
assert.equal(root('foo.bar'), 'foo');
});
test('isDeep()', function() {
@@ -40,50 +32,50 @@ suite('path utilities', function() {
});
test('isAncestor()', function() {
assert.equal(Path.isAncestor('foo.bar', 'foo'), true);
assert.equal(isAncestor('foo.bar', 'foo'), true);
assert.equal(Path.isAncestor('foo.bar', 'foo.bar'), false);
assert.equal(Path.isAncestor('foo.bar', 'foo.baz'), false);
assert.equal(Path.isAncestor('foo.bar', 'fooz'), false);
assert.equal(Path.isAncestor('foo.bar', 'bar'), false);
assert.equal(Path.isAncestor('foo.bar', 'foo.bars'), false);
assert.equal(Path.isAncestor('foo.bar', 'foo.bar.quux'), false);
assert.equal(isAncestor('foo.bar', 'foo.bar'), false);
assert.equal(isAncestor('foo.bar', 'foo.baz'), false);
assert.equal(isAncestor('foo.bar', 'fooz'), false);
assert.equal(isAncestor('foo.bar', 'bar'), false);
assert.equal(isAncestor('foo.bar', 'foo.bars'), false);
assert.equal(isAncestor('foo.bar', 'foo.bar.quux'), false);
assert.equal(Path.isAncestor('foo.bar.baz', 'foo'), true);
assert.equal(Path.isAncestor('foo.bar.baz', 'foo.bar'), true);
assert.equal(isAncestor('foo.bar.baz', 'foo'), true);
assert.equal(isAncestor('foo.bar.baz', 'foo.bar'), true);
assert.equal(Path.isAncestor('foo.bar.baz', 'foo.baz'), false);
assert.equal(Path.isAncestor('foo.bar.baz', 'foo.bars'), false);
assert.equal(isAncestor('foo.bar.baz', 'foo.baz'), false);
assert.equal(isAncestor('foo.bar.baz', 'foo.bars'), false);
});
test('isDescendant()', function() {
assert.equal(Path.isDescendant('foo.bar', 'foo.bar.baz'), true);
assert.equal(Path.isDescendant('foo.bar', 'foo.bar'), false);
assert.equal(Path.isDescendant('foo.bar', 'foo.bars'), false);
assert.equal(Path.isDescendant('foo.bar', 'foo'), false);
assert.equal(Path.isDescendant('foo.bar', 'bar'), false);
assert.equal(isDescendant('foo.bar', 'foo.bar.baz'), true);
assert.equal(isDescendant('foo.bar', 'foo.bar'), false);
assert.equal(isDescendant('foo.bar', 'foo.bars'), false);
assert.equal(isDescendant('foo.bar', 'foo'), false);
assert.equal(isDescendant('foo.bar', 'bar'), false);
assert.equal(Path.isDescendant('foo', 'foo.bar'), true);
assert.equal(Path.isDescendant('foo', 'foo'), false);
assert.equal(isDescendant('foo', 'foo.bar'), true);
assert.equal(isDescendant('foo', 'foo'), false);
});
test('translate()', function() {
assert.equal(Path.translate('foo', 'baz', 'foo.bar'),
assert.equal(translate('foo', 'baz', 'foo.bar'),
'baz.bar');
assert.equal(Path.translate('foo', 'quux', 'foo.bar.baz'),
assert.equal(translate('foo', 'quux', 'foo.bar.baz'),
'quux.bar.baz');
assert.equal(Path.translate('foo.bar', 'quux', 'foo.bar.baz'),
assert.equal(translate('foo.bar', 'quux', 'foo.bar.baz'),
'quux.baz');
});
test('matches()', function() {
assert.equal(Path.matches('foo.bar','foo'), true);
assert.equal(Path.matches('foo.bar','foo.bar'), true);
assert.equal(Path.matches('foo.bar','foo.bar.baz'), true);
assert.equal(Path.matches('foo.bar','fooz'), false);
assert.equal(Path.matches('foo.bar','foo.baz'), false);
assert.equal(Path.matches('foo.bar','foo.bars'), false);
assert.equal(matches('foo.bar','foo'), true);
assert.equal(matches('foo.bar','foo.bar'), true);
assert.equal(matches('foo.bar','foo.bar.baz'), true);
assert.equal(matches('foo.bar','fooz'), false);
assert.equal(matches('foo.bar','foo.baz'), false);
assert.equal(matches('foo.bar','foo.bars'), false);
});
});
</script>

View File

@@ -18,19 +18,19 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<body>
<script type="module">
import { beforeNextRender as beforeNextRender$0, afterNextRender as afterNextRender$0 } from '../../lib/utils/render-status.js';
import { beforeNextRender, afterNextRender } from '../../lib/utils/render-status.js';
import { LegacyElementMixin } from '../../lib/legacy/legacy-element-mixin.js';
class XFoo extends LegacyElementMixin(HTMLElement) {
ready() {
super.ready();
sinon.spy(this, 'beforeNextRender');
sinon.spy(this, 'stillBeforeNextRender');
beforeNextRender$0(this, this.beforeNextRender,
beforeNextRender(this, this.beforeNextRender,
['before']);
}
beforeNextRender() {
beforeNextRender$0(this, this.stillBeforeNextRender,
beforeNextRender(this, this.stillBeforeNextRender,
['still-before']);
}
stillBeforeNextRender() {
@@ -46,13 +46,13 @@ class XBar extends LegacyElementMixin(HTMLElement) {
super.ready();
sinon.spy(this, 'afterNextRender');
sinon.spy(this, 'afterAfterNextRender');
afterNextRender$0(this, (a) => {
afterNextRender(this, (a) => {
this.afterNextRender(a);
}, ['after']);
}
afterNextRender() {
afterNextRender$0(this, (a) => {
afterNextRender(this, (a) => {
this.afterAfterNextRender(a);
}, ['after-after']);
}

View File

@@ -299,7 +299,7 @@ Polymer({
</script>
<script type="module">
import { Polymer } from '../../polymer-legacy.js';
import { flush as flush$0 } from '../../lib/utils/flush.js';
import { flush } from '../../lib/utils/flush.js';
function createPatchedDocumentFragment() {
var frag = document.createDocumentFragment();
return frag;
@@ -1223,7 +1223,7 @@ suite('appendChild & removeChild of <slot>', function() {
var div = document.createElement('div');
document.body.appendChild(x1);
document.body.appendChild(div);
flush$0();
flush();
assert.equal(x1.$.dist.children.length, 4);
div.appendChild(x1);
@@ -1441,26 +1441,26 @@ suite('dom-if append <slot>', function() {
var c1 = document.createElement('div');
c1.slot = 'one';
el.appendChild(c1);
flush$0();
flush();
assert.equal(el.querySelector('[slot="one"]'), c1);
assert.notOk(el.root.querySelector('#static'));
assert.notOk(el.root.querySelector('slot'));
el.$.contentIf.if = true;
el.$.staticIf.if = true;
flush$0();
flush();
assert.ok(el.root.querySelector('#static'));
var ip = el.root.querySelector('slot');
assert.ok(ip);
assert.equal(ip.assignedNodes({flatten: true})[0], c1);
el.$.contentIf.if = false;
el.$.staticIf.if = false;
flush$0();
flush();
assert.equal(el.querySelector('[slot="one"]'), c1);
assert.notOk(el.root.querySelector('#static'));
assert.notOk(el.root.querySelector('slot'));
el.$.contentIf.if = true;
el.$.staticIf.if = true;
flush$0();
flush();
assert.ok(el.root.querySelector('#static'));
ip = el.root.querySelector('slot');
assert.ok(ip);

View File

@@ -726,7 +726,7 @@ Polymer({
</dom-module>
<script type="module">
import { updateStyles as updateStyles$0 } from '../../lib/mixins/element-mixin.js';
import { updateStyles } from '../../lib/mixins/element-mixin.js';
import { dom } from '../../lib/legacy/polymer.dom.js';
suite('scoped-styling-var', function() {
@@ -959,9 +959,9 @@ test('updateStyles called in observer when element not attached', function() {
test('styles update based on root customStyle changes', function() {
assertComputed(styled.$.dynamic, '0px');
updateStyles$0({'--dynamic': '4px solid navy'});
updateStyles({'--dynamic': '4px solid navy'});
assertComputed(styled.$.dynamic, '4px');
updateStyles$0({'--dynamic': '6px solid gray'});
updateStyles({'--dynamic': '6px solid gray'});
assertComputed(styled.$.dynamic, '6px');
});

View File

@@ -9,7 +9,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/
import { Polymer } from '../../lib/legacy/polymer-fn.js';
import { templatize as templatize$0 } from '../../lib/utils/templatize.js';
import { templatize } from '../../lib/utils/templatize.js';
import { Templatizer } from '../../lib/legacy/templatizer-behavior.js';
import { html } from '../../lib/utils/html-tag.js';
@@ -72,7 +72,7 @@ Polymer({
},
go: function(withProps) {
var template = this.querySelector('template');
var ctor = templatize$0(template, this, {
var ctor = templatize(template, this, {
parentModel: true,
instanceProps: {
obj: true,