Socket
Socket
Sign inDemoInstall

checklist-model

Package Overview
Dependencies
0
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.0 to 0.4.0

docs/blocks/comparator-expression/ctrl.js

16

checklist-model.js

@@ -51,3 +51,3 @@ /**

$compile(elem)(scope);
attrs.$set("checklistModel", checklistModel);
attrs.$set("checklistModel", checklistModel);

@@ -66,3 +66,11 @@ // getter / setter for original model

if (attrs.hasOwnProperty('checklistComparator')){
comparator = $parse(attrs.checklistComparator)(scope.$parent);
if (attrs.checklistComparator[0] == '.') {
var comparatorExpression = attrs.checklistComparator.substring(1);
comparator = function (a, b) {
return a[comparatorExpression] === b[comparatorExpression];
}
} else {
comparator = $parse(attrs.checklistComparator)(scope.$parent);
}
}

@@ -108,4 +116,4 @@

if ((tElement[0].tagName !== 'INPUT' || tAttrs.type !== 'checkbox')
&& (tElement[0].tagName !== 'MD-CHECKBOX')
&& (!tAttrs.btnCheckbox)) {
&& (tElement[0].tagName !== 'MD-CHECKBOX')
&& (!tAttrs.btnCheckbox)) {
throw 'checklist-model should be applied to `input[type="checkbox"]` or `md-checkbox`.';

@@ -112,0 +120,0 @@ }

@@ -18,5 +18,9 @@ app.controller('Ctrl3', function($scope) {

$scope.checkFirst = function() {
$scope.user.roles.splice(0, $scope.user.roles.length);
$scope.user.roles = [];
$scope.user.roles.push($scope.roles[0]);
};
$scope.setToNull = function() {
$scope.user.roles = null;
};
});

@@ -24,2 +24,7 @@ describe('array-object', function() {

it('should set model to null', function() {
element(s+'button[ng-click="setToNull()"]').click();
check(a, [0,0,0,0]);
expect(element(s+'pre').text()).toBe('null');
});
it('should check all', function() {

@@ -26,0 +31,0 @@ element(s+'button[ng-click="checkAll()"]').click();

@@ -10,8 +10,43 @@ describe('filter', function() {

//it('should check of roles are changed to new value before checklist-change is fired', function() {
// element(s+'button[ng-click="checkFirst()"]').click();
// check(a, [1,0,0,0]);
// expect(element(s+'pre').text()).toBe('a');
//});
it('should initialize with correct values', function() {
check(a, [0,0,0]);
expect(element(s+'pre').text()).toBe("[]");
});
it('should check/uncheck items', function() {
using(s+'label:eq(0)').input('checked').check(true);
check(a, [1,0,0]);
expect(element(s+'pre').text()).toMatch('id');
expect(element(s+'pre').text()).toMatch('Aaron');
using(s+'label:eq(0)').input('checked').check(false);
check(a, [0,0,0]);
expect(element(s+'pre').text()).toBe('[]');
using(s+'label:eq(1)').input('checked').check(true);
check(a, [0,1,0]);
expect(element(s+'pre').text()).toMatch('id');
expect(element(s+'pre').text()).toMatch('David');
});
it('should check all', function() {
element(s+'button[ng-click="checkAll()"]').click();
check(a, [1,1,1]);
expect(element(s+'pre').text()).toMatch('id');
expect(element(s+'pre').text()).toMatch('David');
expect(element(s+'pre').text()).toMatch('Aaron');
expect(element(s+'pre').text()).toMatch('Moses');
});
it('should uncheck all', function() {
element(s+'button[ng-click="uncheckAll()"]').click();
check(a, [0,0,0]);
expect(element(s+'pre').text()).toBe('[]');
});
it('should check first', function() {
element(s+'button[ng-click="checkFirst()"]').click();
check(a, [1,0,0]);
expect(element(s+'pre').text()).toMatch('id');
expect(element(s+'pre').text()).toMatch('Aaron');
});
});
{
"name": "checklist-model",
"description": "AngularJS directive for list of checkboxes",
"version": "0.3.0",
"version": "0.4.0",
"homepage": "http://vitalets.github.io/checklist-model",

@@ -6,0 +6,0 @@ "author": {

@@ -31,3 +31,8 @@ ## checklist-model

### Development
We're using grunt as the build system. `grunt jade` generates the demo file and `grunt server` starts the demo server that can be access at `http://localhost:8000`. Tests can be ran by accessing `http://localhost:8000/test`.
The best way to involve is to report an issue/enhancement and then provide a pull request for it using Github usual features.
### License
MIT

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc