Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LukaszWatroba committed Jan 8, 2015
1 parent 7458532 commit 1b14300
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 44 deletions.
3 changes: 2 additions & 1 deletion dist/v-accordion.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* vAccordion - AngularJS multi-level accordion component
* @version v0.0.4
* @version v0.1.0
* @link http://lukaszwatroba.github.io/v-accordion
* @author Łukasz Wątroba <l@lukaszwatroba.com>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand All @@ -9,6 +9,7 @@
/***************************************
Accordion
***************************************/
/* Settings */
/**
* Example HTML:
*
Expand Down
16 changes: 8 additions & 8 deletions dist/v-accordion.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* vAccordion - AngularJS multi-level accordion component
* @version v0.0.4
* @version v0.1.0
* @link http://lukaszwatroba.github.io/v-accordion
* @author Łukasz Wątroba <l@lukaszwatroba.com>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down Expand Up @@ -65,18 +65,18 @@ function vAccordionDirective (accordionConfig) {
function checkCustomControlAPIMethods () {
angular.forEach(protectedApiMethods, function (iteratedMethodName) {
if (scope.control[iteratedMethodName]) {
throw new Error(iteratedMethodName + ' method can not be overwritten');
throw new Error('The `' + iteratedMethodName + '` method can not be overwritten');
}
});
}

function checkCustomControlCallbacks () {
if (!angular.isFunction( scope.control.onExpand )) {
throw new Error('onExpand callback must be a function');
throw new Error('The `onExpand` callback must be a function');
}

if (!angular.isFunction( scope.control.onCollapse )) {
throw new Error('onCollapse callback must be a function');
throw new Error('The `onCollapse` callback must be a function');
}
}

Expand Down Expand Up @@ -142,7 +142,7 @@ function AccordionDirectiveController ($scope) {
ctrl.addPane = function (pane) {
if (!$scope.allowMultiple) {
if (hasExpandedPane() && pane.isExpanded) {
throw new Error('allow-multiple attribute is not set');
throw new Error('The `allow-multiple` attribute is not set');
}
}

Expand Down Expand Up @@ -201,7 +201,7 @@ function AccordionDirectiveController ($scope) {
ctrl.expand(iteratedPane);
});
} else {
throw new Error('allow-multiple attribute is not set');
throw new Error('The `allow-multiple` attribute can\'t be found');
}
};

Expand Down Expand Up @@ -323,11 +323,11 @@ function vPaneDirective ($timeout, $animate, accordionConfig) {
paneContentNative = iElement[0].querySelector('.' + accordionConfig.classes.paneContent);

if (!paneHeaderNative) {
throw new Error('v-pane-header not found');
throw new Error('The `v-pane-header` directive can\'t be found');
}

if (!paneContentNative) {
throw new Error('v-pane-content not found');
throw new Error('The `v-pane-content` directive can\'t be found');
}

var paneInnerNative = paneContentNative.querySelector('div');
Expand Down
2 changes: 1 addition & 1 deletion dist/v-accordion.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/v-accordion.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "v-accordion",
"description": "vAccordion - AngularJS multi-level accordion component",
"version": "0.0.4",
"version": "0.1.0",
"author": "Łukasz Wątroba <l@lukaszwatroba.com>",
"license": "MIT",
"keywords": [
Expand Down
10 changes: 5 additions & 5 deletions src/vAccordion/directives/v-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ function vAccordionDirective (accordionConfig) {
function checkCustomControlAPIMethods () {
angular.forEach(protectedApiMethods, function (iteratedMethodName) {
if (scope.control[iteratedMethodName]) {
throw new Error(iteratedMethodName + ' method can not be overwritten');
throw new Error('The `' + iteratedMethodName + '` method can not be overwritten');
}
});
}

function checkCustomControlCallbacks () {
if (!angular.isFunction( scope.control.onExpand )) {
throw new Error('onExpand callback must be a function');
throw new Error('The `onExpand` callback must be a function');
}

if (!angular.isFunction( scope.control.onCollapse )) {
throw new Error('onCollapse callback must be a function');
throw new Error('The `onCollapse` callback must be a function');
}
}

Expand Down Expand Up @@ -107,7 +107,7 @@ function AccordionDirectiveController ($scope) {
ctrl.addPane = function (pane) {
if (!$scope.allowMultiple) {
if (hasExpandedPane() && pane.isExpanded) {
throw new Error('allow-multiple attribute is not set');
throw new Error('The `allow-multiple` attribute is not set');
}
}

Expand Down Expand Up @@ -166,7 +166,7 @@ function AccordionDirectiveController ($scope) {
ctrl.expand(iteratedPane);
});
} else {
throw new Error('allow-multiple attribute is not set');
throw new Error('The `allow-multiple` attribute can\'t be found');
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/vAccordion/directives/v-pane.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ function vPaneDirective ($timeout, $animate, accordionConfig) {
paneContentNative = iElement[0].querySelector('.' + accordionConfig.classes.paneContent);

if (!paneHeaderNative) {
throw new Error('v-pane-header not found');
throw new Error('The `v-pane-header` directive can\'t be found');
}

if (!paneContentNative) {
throw new Error('v-pane-content not found');
throw new Error('The `v-pane-content` directive can\'t be found');
}

var paneInnerNative = paneContentNative.querySelector('div');
Expand Down
9 changes: 6 additions & 3 deletions src/vAccordion/styles/v-accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
***************************************/


/* Settings */

$accordion-spacing: 20px;
$accordion-expand-duration: 0.5s;


/**
* Example HTML:
*
Expand All @@ -15,9 +21,6 @@
*/


$accordion-spacing: 20px;
$accordion-expand-duration: 0.5s;

.Accordion {
height: 100%;
width: 100%;
Expand Down
10 changes: 5 additions & 5 deletions test/unit/vAccordion/directives/v-accordion.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('v-accordion directive', function () {



it('should replace v-accordion with div element and add a class', function () {
it('should replace `v-accordion` with `div` element and `Accordion` class', function () {
var template = generateTemplate();
var accordion = $compile(template)(scope);

Expand All @@ -66,15 +66,15 @@ describe('v-accordion directive', function () {
});


it('should allow multiple selections even if allow-multiple attribute has no value', function () {
it('should allow multiple selections if `allow-multiple` attribute is defined', function () {
var template = generateTemplate({ allowMultiple: true });
var accordion = $compile(template)(scope);

expect(accordion.isolateScope().allowMultiple).toBe(true);
});


it('should merge custom control object with internal control', function () {
it('should extend custom control object with internal control', function () {
var template = generateTemplate({ customControl: true });
var accordion = $compile(template)(scope);

Expand Down Expand Up @@ -141,7 +141,7 @@ describe('v-accordion directive', function () {



it('should add pane to array', function () {
it('should add new pane object to `panes` array', function () {
var samplePane = generatePanes(1)[0];

expect(isolateScope.panes.length).toBe(0);
Expand All @@ -152,7 +152,7 @@ describe('v-accordion directive', function () {
});


it('should expand pane and call onExpand callback', function () {
it('should expand pane and call `onExpand` callback', function () {
var samplePanes = generatePanes(5);
var paneToExpandIndex = 0;
var paneToExpand = samplePanes[paneToExpandIndex];
Expand Down
6 changes: 3 additions & 3 deletions test/unit/vAccordion/directives/v-pane-content.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ describe('v-pane-content directive', function () {



it('should throw an error if is used outside v-pane directive', function () {
it('should throw an error if `v-pane` directive controller can\'t be found', function () {
var template = '<v-pane-content></v-pane-content>';

expect(function () { $compile(template)(scope); }).toThrow();
});


it('should replace v-pane-content with div element and add a class', function () {
it('should replace `v-pane-content` with `div` element and add `Pane-content` class', function () {
var template = generateTemplate();

var accordion = $compile(template)(scope);
Expand All @@ -58,7 +58,7 @@ describe('v-pane-content directive', function () {
});


it('should transclude scope and create inner div wrapper', function () {
it('should transclude scope and create inner `div` wrapper', function () {
var message = 'Hello World!';

var template = generateTemplate({ transcludedContent: '{{ message }}' });
Expand Down
6 changes: 3 additions & 3 deletions test/unit/vAccordion/directives/v-pane-header.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ describe('v-pane-header directive', function () {



it('should throw an error if is used outside v-pane directive', function () {
it('should throw an error if `v-pane` directive controller can\'t be found', function () {
var template = '<v-pane-header></v-pane-header>';

expect(function () { $compile(template)(scope); }).toThrow();
});


it('should replace v-pane-header with div accordion and add a class', function () {
it('should replace `v-pane-header` with `div` accordion and add `Pane-header` class', function () {
var template = generateTemplate();

var accordion = $compile(template)(scope);
Expand All @@ -59,7 +59,7 @@ describe('v-pane-header directive', function () {
});


it('should transclude scope and create inner div wrapper', function () {
it('should transclude scope and create inner `div` wrapper', function () {
var message = 'Hello World!';

var template = generateTemplate({ transcludedContent: '{{ message }}' });
Expand Down
Loading

0 comments on commit 1b14300

Please sign in to comment.