Skip to content

Commit

Permalink
Fixed tests, added test for 'useCachedBackgroundWithSource' API and b…
Browse files Browse the repository at this point in the history
…umped version to 1.2.0
  • Loading branch information
adrianmarinica committed Mar 3, 2017
1 parent 8b09885 commit 0103121
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## master ##

## 1.2.0 ##

### NEW ###

* Added `useCachedBackgroundWithSource` API method (#195)

### FIXED ###

* Fix for usePersistentCache flag not working (#197)

## 1.1.0 ##

### NEW ###
Expand Down
10 changes: 8 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@
ImgCache.useCachedFileWithSource(getAppropriateElement($test_img), $test_img.attr('src'), ok, nok);
}
},
{
name: 'useCachedBackgroundWithSource',
test: function (ok, nok) {
ImgCache.useCachedBackgroundWithSource(getAppropriateElement($test_div), $test_div.css('background-image').replace(/^url\(['"]?/,'').replace(/['"]?\)$/,''), ok, nok);
}
},
{
name: 'getCacheFolderURI',
test: function (ok, nok) {
Expand Down Expand Up @@ -377,7 +383,7 @@
#version { font-size: 1.2em; }
#result { font-size: 1.5em; font-weight: bold; }
#test_img { display: none; }
.bgimg { display: none; background-image: url(http://data-gov.tw.rpi.edu/w/images/thumb/b/b1/State-lib-sum.png/180px-State-lib-sum.png); }
.bgimg { display: none; background-image: url(https://i.imgur.com/RpikbHf.jpg); }
#actions li {
line-height: 2em;
}
Expand Down Expand Up @@ -411,7 +417,7 @@ <h1>imgcache.js</h1>
</div>

<!-- this is the test image, it needs to in a CORS enabled domain -->
<img id="test_img" src="http://data-gov.tw.rpi.edu/w/images/thumb/b/b1/State-lib-sum.png/120px-State-lib-sum.png">
<img id="test_img" src="https://i.imgur.com/RpikbHf.jpg">
<!-- this is the test div, it needs to in a CORS enabled domain -->
<div id="test_div" class="bgimg">&nbsp;</div>
<br/>
Expand Down
2 changes: 1 addition & 1 deletion js/imgcache.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/*global console,LocalFileSystem,device,FileTransfer,define,module*/

var ImgCache = {
version: '1.1.0',
version: '1.2.0',
// options to override before using the library (but after loading this script!)
options: {
debug: false, /* call the log method ? */
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
summary: "JS library that stores images locally for offline apps using PhoneGap/Cordova or browsers supporting the new html5 File API",
version: "1.1.0",
version: "1.2.0",
git: "https://github.com/chrisben/imgcache.js"
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imgcache.js",
"version": "1.1.0",
"version": "1.2.0",
"description": "JS library based on the File API to cache images for offline recovery (target: cordova/phonegap & chrome)",
"main": "js/imgcache.js",
"directories": {
Expand Down

0 comments on commit 0103121

Please sign in to comment.