diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..8b8eb6f5
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,15 @@
+language: node_js
+sudo: false
+node_js:
+ - '6'
+before_script:
+ - export DISPLAY=:99.0
+ - sh -e /etc/init.d/xvfb start
+install:
+ - npm install
+ - npm install bower
+ - bower install
+cache:
+ directories:
+ - bower_components
+ - node_modules
\ No newline at end of file
diff --git a/README.md b/README.md
index 4f78345e..f06decc7 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@ Cloudinary
==========
The official [Cloudinary](https://cloudinary.com) SDK for AngularJS (AKA Angular 1).
-Cloudinary's Angular 2 SDK can be found [here](https://github.com/cloudinary/cloudinary_angular/tree/angular_next)
+Cloudinary's Angular SDK can be found [here](https://github.com/cloudinary/cloudinary_angular)
and on [npm](https://www.npmjs.com/package/@cloudinary/angular)
Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.
diff --git a/bower.json b/bower.json
index 2497dec1..a56113d7 100644
--- a/bower.json
+++ b/bower.json
@@ -28,7 +28,8 @@
],
"dependencies": {
"angular": ">=1.3.10",
- "cloudinary-core": "^2.0.4"
+ "cloudinary-core": "^2.0.4",
+ "bootstrap": "^3.3.7"
},
"repository": {
"type": "git",
@@ -43,6 +44,7 @@
"karma*"
],
"devDependencies": {
- "angular-mocks": "^1.5.1"
+ "angular-mocks": "^1.5.1",
+ "bootstrap": "^3.3.7"
}
}
diff --git a/js/angular.cloudinary.js b/js/angular.cloudinary.js
index c4e11188..7b36c624 100644
--- a/js/angular.cloudinary.js
+++ b/js/angular.cloudinary.js
@@ -88,6 +88,7 @@
return {
restrict : 'E',
transclude : false,
+ priority: 600,
require: '^clImage',
link : function (scope, element, attrs, clImageCtrl) {
clImageCtrl.addTransformation(toCloudinaryAttributes(attrs, /^[^$]/));
diff --git a/package.json b/package.json
index f23756ab..504e9103 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"test": "test"
},
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "test": "karma start karma.conf.js"
},
"repository": {
"type": "git",
diff --git a/spec/cloudinary_spec.js b/spec/cloudinary_spec.js
index 44924474..0bbe84d9 100644
--- a/spec/cloudinary_spec.js
+++ b/spec/cloudinary_spec.js
@@ -1,10 +1,9 @@
-const CLOUD_NAME = "sdk-test";
+const CLOUD_NAME = "sdk-test";
describe("cloudinary", function () {
-
var $compile,
- $rootScope,
- $window;
+ $rootScope,
+ $window;
beforeEach(function () {
module('cloudinary');
angular.module('cloudinary').config(['cloudinaryProvider', function (cloudinaryProvider) {
@@ -54,9 +53,9 @@ describe("cloudinary", function () {
expect(element.html()).toMatch("src=\"https?://res\.cloudinary\.com/" + CLOUD_NAME + "/image/upload/barfoo\"");
});
});
- describe("html-width", function(){
+ describe("html-width", function () {
var element;
- beforeEach(function(){
+ beforeEach(function () {
$rootScope.testPublicId = "sample";
element = $compile("
")($rootScope);
$rootScope.$digest();
@@ -79,9 +78,9 @@ describe("cloudinary", function () {
});
});
-
- describe ('conditional transformation', function(){
- it ('should add if (condition) to the result URL', function() {
+
+ describe('conditional transformation', function () {
+ it('should add if (condition) to the result URL', function () {
// Compile a piece of HTML containing the directive
var element = $compile("
")($rootScope);
$rootScope.$digest();
@@ -89,42 +88,42 @@ describe("cloudinary", function () {
// Check that the compiled element contains the templated content
expect(element.html()).toMatch("src=\"https?://res\.cloudinary\.com/" + CLOUD_NAME + "/image/upload/if_w_gt_200,c_scale,w_100/foobar\"");
});
-
- it ('should add if (condition) to the result URL', function() {
+
+ it('should add if (condition) to the result URL', function () {
// Compile a piece of HTML containing the directive
var element = $compile("
")($rootScope);
$rootScope.$digest();
// Check that the compiled element contains the templated content
expect(element.html()).toMatch("src=\"https?://res\.cloudinary\.com/" + CLOUD_NAME + "/image/upload/if_w_gt_200,c_scale,w_100/foobar\"");
- });
-
- it ('should add if (condition) to the result URL', function() {
+ });
+
+ it('should add if (condition) to the result URL', function () {
// Compile a piece of HTML containing the directive
- var element = $compile("" +
- "
" +
- ""+
- "" +
- ""+
- "" +
+ var element = $compile("" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
"
")($rootScope);
$rootScope.$digest();
// Check that the compiled element contains the templated content
expect(element.html()).toMatch("src=\"https?://res\.cloudinary\.com/" + CLOUD_NAME + "/image/upload/if_w_gt_200/c_scale,w_100/c_fill,h_100/if_end/foobar\"");
});
-
- it ('should add if (condition) to the result URL', function() {
+
+ it('should add if (condition) to the result URL', function () {
// Compile a piece of HTML containing the directive
- var element = $compile("" +
- "
" +
- ""+
- "" +
- ""+
+ var element = $compile("" +
+ "" +
+ "" +
+ "" +
+ "" +
"" +
- "" +
- ""+
- "" +
+ "" +
+ "" +
+ "" +
"
")($rootScope);
$rootScope.$digest();
@@ -132,35 +131,46 @@ describe("cloudinary", function () {
expect(element.html()).toMatch("src=\"https?://res\.cloudinary\.com/" + CLOUD_NAME + "/image/upload/if_w_gt_200/c_scale,w_100/c_fill,h_100/if_else/c_fill,w_200/c_fit,h_200/if_end/foobar\"");
});
});
-
+
describe("responsive", function () {
var testWindow, tabImage2, image1;
+ const isPhantomJS = /PhantomJS/.test(window.navigator.userAgent);
beforeAll(function (done) {
testWindow = window.open("/base/spec/responsive-core-test.html", "Cloudinary test #{(new Date()).toLocaleString()}", "width=200, height=500");
testWindow.addEventListener('load', function () {
image1 = testWindow.document.getElementById("image1");
tabImage2 = testWindow.document.getElementById("tabImage2");
+
expect(tabImage2).toBeDefined();
done();
});
+ setTimeout(done, 3000);
+
});
afterAll(function () {
testWindow && testWindow.close();
});
- it('should enable responsive functionality', function () {
- expect(tabImage2.getAttribute("src")).toMatch("https?://res\.cloudinary\.com/" + CLOUD_NAME + "/image/upload/c_scale,w_200/sample.jpg");
+ it('should enable responsive functionality', function (done) {
+ if (!isPhantomJS) {
+ expect(tabImage2).toBeDefined();
+ expect(tabImage2.outerHTML).toMatch("src=\"https?://res\.cloudinary\.com/" + CLOUD_NAME + "/image/upload/c_scale,w_200/sample.jpg\"");
+ }
+ done();
});
- it("should react to a change in the parent's width", function (done) {
+ it("should react to a change in the parent's width", function (done) {
var listener = function () {
- expect(tabImage2.outerHTML).toMatch("src=\"https?://res\.cloudinary\.com/" + CLOUD_NAME + "/image/upload/c_scale,w_400/sample.jpg\"");
+ if (!isPhantomJS) {
+ expect(tabImage2).toBeDefined();
+ expect(tabImage2.outerHTML).toMatch("src=\"https?://res\.cloudinary\.com/" + CLOUD_NAME + "/image/upload/c_scale,w_400/sample.jpg\"");
+ }
done();
};
// testWindow.addEventListener('resize', listener);
setTimeout(listener, 2000);
- testWindow.resizeTo(350, 800);
+ testWindow && testWindow.resizeTo(350, 800);
});
it('should apply responsive if "width" is not defined', function () {
element = $compile("
")($rootScope);
diff --git a/spec/responsive-core-test.html b/spec/responsive-core-test.html
index da5dbbf1..3a9c20b4 100644
--- a/spec/responsive-core-test.html
+++ b/spec/responsive-core-test.html
@@ -37,7 +37,8 @@ Bootstrap & Cloudinary Responsive Images