Skip to content

Commit

Permalink
Fixed issue with app-localizer-behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed Apr 28, 2017
1 parent 02f063a commit 787890d
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bower.json
Expand Up @@ -49,7 +49,8 @@
"iron-component-page": "^1.1.7",
"elements-demo-resources": "*",
"vaadin-combo-box": "^1.2.0",
"iron-ajax": "PolymerElements/iron-ajax#^1.4.3"
"iron-ajax": "PolymerElements/iron-ajax#^1.4.3",
"app-localize-behavior": "^1.0.2"
},
"dependencies": {
"polymer": "^1.6.1",
Expand Down
82 changes: 82 additions & 0 deletions test/app-localize-behavior.html
@@ -0,0 +1,82 @@
<!doctype html>

<html>
<head>
<meta charset="UTF-8">
<title>iron-list test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>

<link rel="import" href="helpers.html">
<link rel="import" href="../vaadin-grid.html">
<link rel="import" href="../../app-localize-behavior/app-localize-behavior.html">
</head>
<body>

<dom-module id="x-grid">
<template>
<style>
:host {
display: block;
}
</style>

<vaadin-grid id="grid" items="[1]">
<vaadin-grid-column>
<template class="header">[[localize('header')]]</template>
<template>[[item]]</template>
</vaadin-grid-column>
</vaadin-grid>
</template>
<script>
document.addEventListener('WebComponentsReady', function() {
Polymer({
is: 'x-grid',

behaviors: [Polymer.AppLocalizeBehavior],

properties: {
language: {
value: 'en'
}
},

attached: function() {
this.loadResources('locales.json');
}
});
});
</script>
</dom-module>

<test-fixture id="grid">
<template>
<x-grid></x-grid>
</template>
</test-fixture>

<script>

describe('app-localize-behavior', function() {
var container, column, grid;

beforeEach(function(done) {
container = fixture('grid');
grid = container.$.grid;
container.addEventListener('app-localize-resources-loaded', function() {
done();
});
});

it('should localize', function() {
expect(getHeaderCellContent(grid, 0, 0).innerText).to.equal('header');
});

});

</script>

</body>
</html>
1 change: 1 addition & 0 deletions test/index.html
Expand Up @@ -19,6 +19,7 @@
<script>
WCT.loadSuites([
'basic.html',
'app-localize-behavior.html',
'column.html',
'column-group.html',
'column-groups.html',
Expand Down
8 changes: 8 additions & 0 deletions test/locales.json
@@ -0,0 +1,8 @@
{
"en": {
"header": "header"
},
"fr": {
"header": "le header"
}
}
1 change: 1 addition & 0 deletions vaadin-grid-templatizer.html
Expand Up @@ -103,6 +103,7 @@
var value = e.value;

templateInstances.forEach(function(inst) {
inst[prop] = value;
inst.notifyPath(prop, value);
});
}
Expand Down

0 comments on commit 787890d

Please sign in to comment.