/**
 * Conditionizr
 */
describe('Conditionizr', function () {

  /**
   * We should get an Object returned
   */
  it('should return an Object', function () {
    expect(typeof conditionizr).toBe('object');
  });

  /**
   * Loop through the expected public methods to
   * ensure they're all defined
   */
  it('should have all public methods with functions', function() {
    var methods = 'config on add polyfill load'.split(/\s/);
    for (var i = methods.length; i--;) {
      var method = conditionizr[methods[i]];
      expect(method).toBeDefined();
      expect(typeof method).toBe('function');
    }
  });

  /**
   * .add()
   * Add a detect using the .add() method
   * and expect the property to be added
   */
  describe('add()', function () {

    beforeEach(function () {
      // add a real test to ensure it's defined
      conditionizr.add('safari', [], function () {
        return /constructor/i.test(window.HTMLElement);
      });
    });

    it('should add an object property', function () {
      expect(conditionizr.safari).toBeDefined();
    });

  });

  /**
   * Object properties should hold a Boolean value
   * so let's emulate detects which fake true or false
   * to ensure our callback result gets added as the
   * property value
   */
  describe('object booleans', function () {

    beforeEach(function () {
      var returnTrue = function () { return true; };
      var returnFalse = function () { return false; };
      conditionizr.add('faketrue', ['class'], returnTrue);
      conditionizr.add('fakefalse', ['class'], returnFalse);
    });

    it('should result in a boolean value', function () {
      expect(conditionizr.faketrue).toBe(true);
      expect(conditionizr.fakefalse).toBe(false);
    });

  });

  /**
   * Class names are added the the <html> tag
   * when the object property value is true.
   * There are also two ways to declare classes to add,
   * using .add() inline ['class'] array, or using .config()
   */
  describe('class names on <html>', function () {

    beforeEach(function () {
      var returnTrue = function () { return true; };
      var returnFalse = function () { return false; };
      conditionizr.add('fakeTrueUsingAdd', ['class'], returnTrue);
      conditionizr.add('fakeFalseUsingAdd', ['class'], returnFalse);
      conditionizr.add('fakeTrueUsingConfig', [], returnTrue);
      conditionizr.add('fakeFalseUsingConfig', [], returnFalse);
      conditionizr.config({
          tests:{
              'fakeTrueUsingConfig': ['class'],
              'fakeFalseUsingConfig': ['class']
          }
      });
    });

    it('should add the faketrue classNames from add() and config()', function () {
      expect(document.documentElement.className).toContain('faketrueusingadd');
      expect(document.documentElement.className).toContain('faketrueusingconfig');
      expect(document.documentElement.className).not.toContain('fakefalseusingadd');
      expect(document.documentElement.className).not.toContain('fakefalseusingconfig');
    });

  });

  /**
   * Will fire when a property is true
   */
  describe('on()', function () {

    beforeEach(function () {
      conditionizr.add('faketrue', [], function () {
        return true;
      });
    });

    it('should run a callback when the value is true', function () {
      spyOn(conditionizr, 'on');
      conditionizr.on('fake', function () {});
      expect(conditionizr.on).toHaveBeenCalledWith('fake', jasmine.any(Function));
    });

  });

  /**
   * TODO:
   * .polyfill()
   * .load()
   * .config()
   */

});

@@ -614,472 +614,8 @@
 );%0A%0A
-  /**%0A   * .add()%0A   * Add a detect using the .add() method%0A   * and expect the property to be added%0A   */%0A  describe('add()', function () %7B%0A%0A    beforeEach(function () %7B%0A      // add a real test to ensure it's defined%0A      conditionizr.add('safari', %5B%5D, function () %7B%0A        return /constructor/i.test(window.HTMLElement);%0A      %7D);%0A    %7D);%0A%0A    it('should add an object property', function () %7B%0A      expect(conditionizr.safari).toBeDefined();%0A    %7D);%0A%0A  %7D);%0A%0A
   /*
@@ -2213,31 +2213,42 @@
  () %7B%0A      
-expect(
+var htmlElement = 
 document.doc
@@ -2261,32 +2261,58 @@
 lement.className
+;%0A      expect(htmlElement
 ).toContain('fak
@@ -2345,42 +2345,19 @@
 ect(
-document.documentElement.className
+htmlElement
 ).to
@@ -2405,42 +2405,19 @@
 ect(
-document.documentElement.className
+htmlElement
 ).no
@@ -2467,42 +2467,19 @@
 ect(
-document.documentElement.className
+htmlElement
 ).no
@@ -2533,24 +2533,514 @@
  %7D);%0A%0A  /**%0A
+   * Method: .add()%0A   * Add a detect using the .add() method%0A   * and expect the property to be added%0A   */%0A  describe('add()', function () %7B%0A%0A    beforeEach(function () %7B%0A      // add a real test to ensure it's defined%0A      conditionizr.add('safari', %5B%5D, function () %7B%0A        return /constructor/i.test(window.HTMLElement);%0A      %7D);%0A    %7D);%0A%0A    it('should add an object property', function () %7B%0A      expect(conditionizr.safari).toBeDefined();%0A    %7D);%0A%0A  %7D);%0A%0A  /**%0A   * Method: on()%0A
    * Will fi
@@ -3373,16 +3373,28 @@
 ion () %7B
+ return 11; 
 %7D);%0A    
@@ -3510,17 +3510,52 @@
 O:%0A   * 
-.
+- scripts and styles loading%0A   * - 
 polyfill
@@ -3562,17 +3562,30 @@
 ()%0A   * 
-.
+- on()%0A   * - 
 load()%0A 
@@ -3588,17 +3588,18 @@
 ()%0A   * 
-.
+- 
 config()

Update tests