Skip to content

Commit

Permalink
Don't use translate as a method for testing
Browse files Browse the repository at this point in the history
`.translate` is some magical property in Safari (and Chrome)
Safari 7 puts this on the instance, and breaks tests for property
effects
  • Loading branch information
dfreedm committed Mar 24, 2016
1 parent e7254d0 commit f80346f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
8 changes: 4 additions & 4 deletions test/unit/bind-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -595,13 +595,13 @@

<dom-module id="x-bind-computed-property">
<template>
<div id="check">[[translate('Hello World.')]]</div>
<div id="check">[[translateMessage('Hello World.')]]</div>
</template>
<script>
(function(){
var TranslateBehavior = {
properties: {
translate: {
translateMessage: {
type: Function,
computed: '_computeTranslateFn(translator)'
}
Expand Down Expand Up @@ -634,7 +634,7 @@

<dom-module id="x-bind-computed-property-late-translator">
<template>
<div id="check">[[translate(message)]]</div>
<div id="check">[[translateMessage(message)]]</div>
</template>
<script>
Polymer({
Expand All @@ -644,7 +644,7 @@
type: String,
value: 'Hello'
},
translate: {
translateMessage: {
type: Function,
computed: '_computeTranslateFn(translator)'
},
Expand Down
16 changes: 6 additions & 10 deletions test/unit/bind.html
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,6 @@

var el;

setup(function() {

});

teardown(function() {
document.body.removeChild(el);
});
Expand Down Expand Up @@ -334,7 +330,7 @@
Polymer({
is: 'x-observer-with-dynamic-function',
properties: {
translate: {
translateMessage: {
type: Function
},
message: {
Expand All @@ -343,15 +339,15 @@
}
},

observers: ['translate(message)']
observers: ['translateMessage(message)']

});

el = document.createElement('x-observer-with-dynamic-function');
document.body.appendChild(el);

var called = 0;
el.translate = function() {
el.translateMessage = function() {
called += 1;
};

Expand All @@ -364,9 +360,9 @@
is: 'x-computed-property-with-dynamic-function',
properties: {
computedValue: {
computed: "translate('Hello')"
computed: "translateMessage('Hello')"
},
translate: {
translateMessage: {
type: Function
}
}
Expand All @@ -378,7 +374,7 @@
assert.equal(el.computedValue, undefined);

var called = 0;
el.translate = function(message) {
el.translateMessage = function(message) {
called += 1;
return 'translated: ' + message;
};
Expand Down

0 comments on commit f80346f

Please sign in to comment.