import helpers from '../lib/helpers';
import skate from '../../src/skate';

describe('extending', function () {
  var Ctor, tag;

  beforeEach(function () {
    Ctor = skate(helpers.safeTagName().safe, {
      extends: 'div',
      someNonStandardProperty: true,
      created: function (element) {
        element.textContent = 'test';
      },
      attributes: {
        myAttribute: function () {}
      },
      prototype: {
        test: true,
        someFunction: function () {}
      }
    });
    tag = helpers.safeTagName().safe;
  });

  it('should copy all configuration options to the constructor', function () {
    expect(Ctor.extends).to.equal('div');
    expect(Ctor.someNonStandardProperty).to.equal(undefined);
    expect(Ctor.created).to.be.a('function');
    expect(Ctor.attributes.myAttribute).to.be.a('function');
    expect(Ctor.prototype.test).to.equal(true);
    expect(Ctor.prototype.someFunction).to.be.a('function');
  });

  it('should copy all configuration options to the extended object', function () {
    var ExtendedCtor = skate(tag, class extends Ctor {});
    expect(ExtendedCtor.extends).to.equal('div');
    expect(ExtendedCtor.someNonStandardProperty).to.equal(undefined);
    expect(ExtendedCtor.created).to.be.a('function');
    expect(ExtendedCtor.attributes.myAttribute).to.be.a('function');
    expect(ExtendedCtor.prototype.test).to.equal(true);
    expect(ExtendedCtor.prototype.someFunction).to.be.a('function');
  });

  it('should not mess with callbacks', function () {
    var ExtendedCtor = skate(tag, class extends Ctor {});
    expect(new ExtendedCtor().textContent).to.equal('test');
  });

  it('should allow overriding of callbacks', function () {
    var ExtendedCtor = skate(tag, class extends Ctor {
      static created (element) {
        super.created(element);
        element.textContent += 'ing';
      }
    });
    expect(new ExtendedCtor().textContent).to.equal('testing');
  });
});

@@ -1455,32 +1455,274 @@
 ction');%0A  %7D);%0A%0A
+  it('prototype members should be available', function () %7B%0A    var ExtendedCtor = skate(tag, class extends Ctor %7B%7D);%0A    expect(new ExtendedCtor().test).to.equal(true);%0A    expect(new ExtendedCtor().someFunction).to.be.a('function');%0A  %7D);%0A%0A
   it('should not

Write failing test for Firefox. Seems that prototype properties are added to the prototype but not actually applied to the element upon creation.