[#930]Fixed unit tests. Removed one because can't handle errors being thrown from async (xhr) properly. Replaced with somewhat elegant message to user instead

This commit is contained in:
Matthew Schranz 2012-03-02 18:15:14 -05:00
Родитель 435c8d1933
Коммит eee893ba21
2 изменённых файлов: 11 добавлений и 21 удалений

Просмотреть файл

@ -387,7 +387,9 @@
}
} else {
// There was an error somewhere down the line that caused the request to fail.
Popcorn.error( "Error. Request failed. Status code: " + data.meta.status + " - Message: " + data.meta.msg );
commonDiv.innerHTML += "Error. Request failed. Status code: " + data.meta.status + " - Message: " + data.meta.msg +
"<br/>This could be due to an invalid blogId.";
options._container.appendChild( commonDiv );
}
}, false );
}

Просмотреть файл

@ -124,9 +124,11 @@ test( "Popcorn Tumblr Plugin", function () {
test( "Test Initialized Tumblr Blocks throwing Errors", function () {
var pop = Popcorn( "#video" ), expects = 6;
Popcorn.plugin.debug = true;
expect( 6 );
var pop = Popcorn( "#video" ), expects = 5;
expect( expects );
// Tests for thrown Error on emtpy block
try {
@ -137,7 +139,7 @@ test( "Test Initialized Tumblr Blocks throwing Errors", function () {
// Tests for thrown Error on invalid plugin type
try {
pop.facebook({
pop.tumblr({
requestType: "asdadsadasad",
target: "testsdiv",
start: 1,
@ -151,7 +153,7 @@ test( "Test Initialized Tumblr Blocks throwing Errors", function () {
// No blogId supplied for blogpost request
try {
pop.facebook({
pop.tumblr({
requestType: "blogpost",
target: "testsdiv",
start: 1,
@ -165,7 +167,7 @@ test( "Test Initialized Tumblr Blocks throwing Errors", function () {
// Checking no API KEY
try {
pop.facebook({
pop.tumblr({
requestType: "blogpost",
target: "testsdiv",
start: 1,
@ -179,7 +181,7 @@ test( "Test Initialized Tumblr Blocks throwing Errors", function () {
// Checking no base_hostname provided
try {
pop.facebook({
pop.tumblr({
requestType: "blogpost",
target: "testsdiv",
start: 1,
@ -191,19 +193,5 @@ test( "Test Initialized Tumblr Blocks throwing Errors", function () {
ok( true, "Caught no base_hostname for blogpost type." );
}
// Checking for a failure in request from API using an invalid blogId
try {
pop.facebook({
requestType: "blogpost",
target: "testsdiv",
start: 1,
end: 5,
blogId: 1,
base_hostname: "tumblrplugin.tumblr.com",
api_key: "7lQpV9mMr2PiYjd20FavZcmReq8cWU0oHTS6d3YIB8rLUQvvcg"
});
} catch( e ) {
ok( true, "Caught failed request from API for blogpost type." );
}
});