Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
ebidel committed Jun 30, 2013
1 parent c0fff7e commit 15612a0
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/html/polymer-file.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!doctype html>
<html>
<head>
<title>polymer-file</title>
<script src="../../../polymer/polymer.js"></script>
<script src="../../../polymer/tools/test/htmltest.js"></script>
<script src="../../node_modules/chai/chai.js"></script>
<link rel="import" href="../../polymer-file/polymer-file.html">
</head>
<body>

<polymer-file auto readas="text"></polymer-file>

<script>
var assert = chai.assert;
document.addEventListener('WebComponentsReady', function() {
var DATA = 'abc123';

var pfile = document.querySelector('polymer-file');

assert.isNull(pfile.blob);
assert.isTrue(pfile.auto);
assert.equal(pfile.readas, 'text');
assert.isNull(pfile.result, ".auto doesn't start a read");

pfile.blob = new Blob([DATA], {type: 'text/plain'});

pfile.addEventListener('polymer-result', function(e) {
assert.isDefined(e.detail.result);
assert.isString(e.detail.result, 'Result is a text string');
assert.equal(e.detail.result, DATA, 'Result correct data');
assert.equal(pfile.result, DATA, '.result was set correctly');

done();
});
//pfile.read();
});
</script>
</body>
</html>
9 changes: 9 additions & 0 deletions test/js/polymer-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2013 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
*/

htmlSuite('polymer-file', function() {
htmlTest('html/polymer-file.html');
});
1 change: 1 addition & 0 deletions test/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<script src="js/polymer-localstorage.js"></script>
<script src="js/polymer-meta.js"></script>
<script src="js/polymer-collapse.js"></script>
<script src="js/polymer-file.js"></script>
<!-- -->
<script>
mocha.run();
Expand Down

0 comments on commit 15612a0

Please sign in to comment.