<commit_before><commit_msg>add test for pixi-canvas component<commit_after>/* jshint expr:true */
import { expect } from 'chai';
import { describeComponent, it } from 'ember-mocha';
import hbs from 'htmlbars-inline-precompile';

describeComponent('pixi-canvas', 'Integration: PixiCanvasComponent', { integration: true }, () => {
  it('renders a canvas element', function() {
    this.render(hbs`
      {{pixi-canvas}}
    `);

    const $canvas = this.$('canvas');

    expect($canvas).to.be.ok;
  });

  it('renders a canvas element with the specified size', function() {
    this.render(hbs`
      {{pixi-canvas width=200 height=100}}
    `);

    const $canvas = this.$('canvas');
    const width = Number($canvas.attr('width'));
    const height = Number($canvas.attr('height'));

    expect(width).to.eq(200);
    expect(height).to.eq(100);
  });

  it('replaces the canvas element when the dimensions change', function() {
    this.set('width', 200);
    this.set('height', 100);
    this.render(hbs`
      {{pixi-canvas width=width height=height}}
    `);

    const $oldCanvas = this.$('canvas');

    this.set('width', 100);
    this.set('height', 50);

    const $newCanvas = this.$('canvas');
    const width = Number($newCanvas.attr('width'));
    const height = Number($newCanvas.attr('height'));

    expect($oldCanvas).to.not.eql($newCanvas);
    expect(width).to.eq(100);
    expect(height).to.eq(50);
  });
});
{'fraction_non_alphanumeric': 0.18640504555010512, 'fraction_numerical': 0.019621583742116328, 'mean_word_length': 3.76, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6432675', 'n_tokens_mistral': 484, 'n_tokens_neox': 446, 'n_words': 96}