Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

az-promise-show

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

az-promise-show - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# 1.1.0
## New Features
- Adding the `constant` `azPromiseShowOptions` which has a `className` property which you can set to customize the class applied to the element when it should be hidden.
# 1.0.1

@@ -2,0 +8,0 @@

5

package.json
{
"name": "az-promise-show",
"version": "1.0.1",
"version": "1.1.0",
"description": "angular directives to show or hide an element based on the state of a promise",

@@ -16,3 +16,3 @@ "main": "dist/az-promise-show.js",

"babel-loader": "5.1.4",
"better-npm-run": "benoror/better-npm-run",
"better-npm-run": "benoror/better-npm-run#0.0.1",
"chai": "3.0.0",

@@ -43,2 +43,3 @@ "codecov.io": "0.1.2",

"build": "npm run build:dist & npm run build:prod",
"start": "npm run test",
"test": "better-npm-run test",

@@ -45,0 +46,0 @@ "test:ci": "npm run test:single && npm run check-coverage",

@@ -13,2 +13,3 @@ // some versions of angular don't export the angular module properly,

.module('azPromiseShow', [])
.constant('azPromiseShowOptions', {className: 'ng-hide'})
.directive('azPromiseShow', azPromise(true))

@@ -22,8 +23,8 @@ .directive('azPromiseHide', azPromise(false))

var changeFrom = show ? 'addClass' : 'removeClass';
return /* @ngInject */ function azPromiseShowDefinition($log) {
return /* @ngInject */ function azPromiseShowDefinition($log, azPromiseShowOptions) {
return {
restrict: 'A',
link: function(scope, el, attrs) {
var displayNone = attrs.azPromiseShowHideClass || 'ng-hide';
scope.$watch(attrs[attr], function(newVal) {
var displayNone = attrs.azPromiseShowHideClass || azPromiseShowOptions.className;
if (newVal) {

@@ -30,0 +31,0 @@ if (!newVal.finally) {

16

src/index.test.js

@@ -10,8 +10,9 @@ import 'angular';

const basicTemplate = '<div az-promise-show="aPromise"></div>';
let scope, el, $timeout, $compile;
let scope, el, $timeout, $compile, options;
beforeEach(inject((_$compile_, $rootScope, _$timeout_) => {
beforeEach(inject((_$compile_, $rootScope, _$timeout_, azPromiseShowOptions) => {
$timeout = _$timeout_;
$compile = _$compile_;
scope = $rootScope.$new();
options = azPromiseShowOptions;
}));

@@ -53,2 +54,13 @@

it(`should allow you to configure a custom class using 'azPromiseShowOptions'`, () => {
options.className = 'custom-class';
compileAndDigest();
scope.aPromise = $timeout(() => {});
scope.$digest();
expectShowing(options.className);
$timeout.flush();
scope.$digest();
expectHidden(options.className);
});
function compileAndDigest(template = basicTemplate) {

@@ -55,0 +67,0 @@ el = $compile(template)(scope);

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc