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

Commit

Permalink
Scaffold improved test style.
Browse files Browse the repository at this point in the history
  • Loading branch information
garlicnation committed Nov 5, 2014
1 parent 6a45f8b commit 14cd00c
Showing 1 changed file with 37 additions and 15 deletions.
52 changes: 37 additions & 15 deletions test/core-ajax.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,46 @@

</head>
<body>
<!--
TODO(ajo): Mock this response out.
-->
<core-ajax
url="http://gdata.youtube.com/feeds/api/videos/"
params='{"alt":"json", "q":"chrome"}'
handleAs="json"
auto></core-ajax>
<core-ajax></core-ajax>

<script>
test('youtube-ajax', function(done) {
var assert = chai.assert;
var ajax = document.querySelector('core-ajax');
ajax.addEventListener("core-response", function(event) {
assert.isTrue(event.detail.response.feed.entry.length > 0);
done();
});
suite('core-ajax', function() {
var xhr, requests, ajax;
suiteSetup(function() {
xhr = sinon.useFakeXMLHttpRequest();
ajax = document.querySelector("core-ajax");
});
setup(function() {
requests = [];
xhr.onCreate = function (xhr) {
requests.push(xhr);
};
// Reset the core-ajax element before each test.
ajax.auto = false;
ajax.url = '';
ajax.params = '';
ajax.handleAs = 'text';
ajax.body = '';
});
suite('handleAs', function() {
suite('text', function(){});
suite('xml', function(){});
suite('json', function(){});
suite('arraybuffer', function(){});
suite('blob', function(){});
suite('document', function(){});
});
suite('auto', function() {
test('url', function(){});
test('params', function(){});
test('body', function(){});
});
suite('events', function(){
suite('core-response', function(){});
suite('core-error', function(){});
suite('core-complete', function(){});
});
}
</script>

</body>
Expand Down

0 comments on commit 14cd00c

Please sign in to comment.