DailyJS

Blockies, Angular Debaser

Alex R. Young

Subscribe

@dailyjs

Facebook

Google+

libraries ui graphics testing angularjs

Blockies, Angular Debaser

Posted by Alex R. Young on .
Featured

libraries ui graphics testing angularjs

Blockies, Angular Debaser

Posted by Alex R. Young on .

Blockies

Blockies (GitHub: download13 / blockies, License: WTFPL) by Erin Dachtler is a small library that generates avatars based on a random seed and colour.

var icon = blockies.create({  
  seed: 'randstring',
  color: '#dfe',
  size: 15,
  scale: 3
});

The arguments are all optional, and the output is a canvas element that you can insert into a container. The resulting images look a bit like the default GitHub avatars.

Angular Debaser

Angular Debaser (GitHub: decipherinc / angular-debaser, License: MIT) by Christopher Hiller is a library designed to cut down the amount of boilerplate required to test AngularJS projects.

When a module depends on a lot of services, then it can require a lot of stubs to test. To get around that, Debaser provides a more succinct syntax:

debaser()  
  .module('donny.pizzajoint.admin')
  .object('Settings', {
    location_id: 1
  })
  .object('User').withFunc('getAll').returns([])
  .object('Pizza').withFunc('getAll').returns([])
  .object('Toppings').withFunc('getAll').returns({})
  .object('Sides').withFunc('getAll').returns([])
  .object('Orders').withFunc('getPreviousWeek').returns([])
  .object('Deliveries').withFunc('getPreviousWeek').returns([])
  .debase();

It uses angular-mocks, which is "ngMock" from the main AngularJS project.