<commit_before>mediator = require 'mediator'
Sidebar = require 'models/sidebar'
SidebarView = require 'views/sidebar_view'

describe 'SidebarView', ->
  beforeEach ->
    @model = new Sidebar()
    @view = new SidebarView({@model})

  afterEach ->
    @view.dispose()
    @model.dispose()

  it 'should contain only one element when home view is active', ->
    mediator.publish 'navigation:change', {activeView:'home-page'}
    expect(@view.$el.children()).to.have.length 1

  it 'should contain 3 buttons when x3d view is active', ->
    mediator.publish 'navigation:change', {activeView:'x3d-page'}
    expect(@view.$el.find 'button').to.have.length 3

  it 'input forms should contain the values 1, 2 and 3 when x3d view is active', ->
    object = parentElement:
      getAttribute: ->
        '1 2 3'
    mediator.publish 'navigation:change', {activeView:'x3d-page'}
    mediator.publish 'x3d:object:select', object
    expect( (@view.$el.find '#x')[0] ).to.have.property 'value', '1'
    expect( (@view.$el.find '#y')[0] ).to.have.property 'value', '2'
    expect( (@view.$el.find '#z')[0] ).to.have.property 'value', '3'
<commit_msg>Add a test<commit_after>mediator = require 'mediator'
Sidebar = require 'models/sidebar'
SidebarView = require 'views/sidebar_view'

describe 'SidebarView', ->
  beforeEach ->
    @model = new Sidebar()
    @view = new SidebarView({@model})

  afterEach ->
    @view.dispose()
    @model.dispose()

  it 'should contain only one element when home view is active', ->
    mediator.publish 'navigation:change', {activeView:'home-page'}
    expect(@view.$el.children()).to.have.length 1

  it 'should contain 3 buttons when x3d view is active', ->
    mediator.publish 'navigation:change', {activeView:'x3d-page'}
    expect(@view.$el.find 'button').to.have.length 3

  it 'should contain 6 inputs when x3d view is active', ->
    mediator.publish 'navigation:change', {activeView:'x3d-page'}
    expect(@view.$el.find 'input').to.have.length 6

  it 'input forms should contain the values 1, 2 and 3 when x3d view is active', ->
    object = parentElement:
      getAttribute: ->
        '1 2 3'
    mediator.publish 'navigation:change', {activeView:'x3d-page'}
    mediator.publish 'x3d:object:select', object
    expect( (@view.$el.find '#x')[0] ).to.have.property 'value', '1'
    expect( (@view.$el.find '#y')[0] ).to.have.property 'value', '2'
    expect( (@view.$el.find '#z')[0] ).to.have.property 'value', '3'

{'fraction_non_alphanumeric': 0.16483516483516483, 'fraction_numerical': 0.01790801790801791, 'mean_word_length': 3.7360308285163777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '4422688', 'n_tokens_mistral': 826, 'n_tokens_neox': 796, 'n_words': 216}