Skip to content

Commit

Permalink
Merge branch 'release/0.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
edoparearyee committed Feb 9, 2015
2 parents dd9128f + e6057b9 commit 7124ac1
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 17 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,11 @@
## Changes in 0.0.2

* @eopa: Feature/fix travis deployment config (#6)
* @jamesjwarren: Fix: skrollr refresh (#4)
* @jamesjwarren: Feature: travis deploy (#3)

## Changes in 0.0.1

* First Release


20 changes: 18 additions & 2 deletions Gruntfile.js
Expand Up @@ -267,8 +267,19 @@ module.exports = function (grunt) {
outdir: "docs/"
}
}
}
},

bump: {
options: {
files: ["package.json", "bower.json"],
updateConfigs: ["pkg"],
commit: true,
commitFiles: ["-a"],
createTag: true,
push: true,
pushTo: "upstream"
}
}

});

Expand All @@ -285,6 +296,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-protractor-runner");
grunt.loadNpmTasks("grunt-protractor-webdriver");
grunt.loadNpmTasks("grunt-processhtml");
grunt.loadNpmTasks("grunt-bump");

grunt.registerTask("build", [
"clean:beforeBuild",
Expand All @@ -295,6 +307,11 @@ module.exports = function (grunt) {
"yuidoc"
]);

grunt.registerTask("release", [
"build",
"bump"
]);

grunt.registerTask("server", [
"less:development",
"connect:server",
Expand Down Expand Up @@ -330,6 +347,5 @@ module.exports = function (grunt) {
]);

grunt.registerTask("default", ["build"]);
grunt.registerTask("release", ["build"]);

};
49 changes: 41 additions & 8 deletions app/js/skrollr.js
Expand Up @@ -9,7 +9,7 @@ angular.module("sn.skrollr", [])
/**
* Provider to configuring skrollr
* @example
* snSkrollrProvider.init({ smoothScrolling: true });
* snSkrollrProvider.config({ smoothScrolling: true });
* snSkrollr.init();
*/
.provider("snSkrollr", function snSkrollrProvider() {
Expand All @@ -18,28 +18,61 @@ angular.module("sn.skrollr", [])

this.config = {};

this.skrollrInstance = {};

this.hasBeenInitialised = false;

this.serviceMethods = {};

this.$get = [
"$window",
"$document",
"$rootScope",
/**
* @constructor
* @param {Object} $window angular wrapper for window
* @param {Object} $document angular wrapper for document
* @param {Object} $rootScope angular root application scope
*/
function($window, $document, $rootScope) {

return {
_this.serviceMethods = {

/**
* Initialise skrollrjs with config options
* @method init
*/
init: function() {

var skrollrInit = function skrollrInit(){
_this.skrollrInstance = $window.skrollr.init(_this.config);
_this.hasBeenInitialised = true;
_this.serviceMethods.refresh();
};

$document.ready(function () {
$rootScope.$apply(function() {
var s = $window.skrollr.init(_this.config);
});
if (!$rootScope.$$phase) {
$rootScope.$apply(skrollrInit);
} else {
skrollrInit();
}
});

},

/**
* Call refresh on Skrollr instance
* Useful for resetting skrollr after modifying the DOM
* @method refresh
*/
refresh: function() {
if (_this.hasBeenInitialised) {
_this.skrollrInstance.refresh();
}
}
};

return _this.serviceMethods;
}
];
})
Expand All @@ -49,15 +82,15 @@ angular.module("sn.skrollr", [])
* @class snSkrollr
*/
.directive("snSkrollr", [
"$window",
"snSkrollr",
/**
* @constructor
*/
function ($window){
function (snSkrollr){
return {
restrict: "AE",
link: function($scope, $element) {
$window.skrollr.refresh();
snSkrollr.refresh();
}
};
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -13,6 +13,7 @@
"connect-livereload": "~0.5.0",
"connect-modrewrite": "~0.7.9",
"coveralls": "~2.11.2",
"grunt-bump": "~0.1.0",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "~0.5.0",
"grunt-contrib-connect": "~0.9.0",
Expand Down
20 changes: 13 additions & 7 deletions tests/unit/skrollr.js
Expand Up @@ -2,7 +2,7 @@

describe("snSkrollrProvider", function () {

var serviceProvider, $window, $document, spy, scope, rootScope, snSkrollr;
var serviceProvider, $window, $document, spy, scope, rootScope, snSkrollr, refresh, skrollrInstance;

beforeEach(function () {

Expand All @@ -19,16 +19,22 @@ describe("snSkrollrProvider", function () {
scope = $rootScope.$new();
rootScope = $rootScope;

snSkrollr = $injector.get("snSkrollr");

$window = $injector.get("$window");
$window.skrollr = {
init: function() { return }
init: function() {
return {
refresh: function(){}
};
}
}
spy = spyOn($window.skrollr, "init");
spy.and.callThrough();

$document = $injector.get("$document");
$document.ready = function(fn){ fn.call(this); }

snSkrollr = $injector.get("snSkrollr");
});

});
Expand All @@ -46,18 +52,18 @@ describe("snSkrollrProvider", function () {
});

describe("directive: snSkrollr", function() {
var element, scope, isolatedScope, $window, spy;
var element, scope, isolatedScope, snSkrollr, spy;

beforeEach(module("sn.skrollr"));

beforeEach(inject(function ($rootScope, $compile, $injector) {
scope = $rootScope.$new();

$window = $injector.get("$window");
$window.skrollr = {
snSkrollr = $injector.get("snSkrollr");
snSkrollr.skrollr = {
refresh: function() { return }
}
spy = spyOn($window.skrollr, "refresh");
spy = spyOn(snSkrollr, "refresh");

element =
"<sn-skrollr>" +
Expand Down

0 comments on commit 7124ac1

Please sign in to comment.