<commit_before>{Testing, expect, sinon, _} = require 'shared/test/helpers'

{Breadcrumbs} = require 'breadcrumbs'
TASK = require 'cc/tasks/C_UUID/m_uuid/GET'
tasks = require 'task/collection'

describe 'Breadcrumbs Component', ->
  beforeEach ->
    @props =
      goToStep: sinon.spy()
      moduleUUID: 'm_uuid'
      collectionUUID: 'C_UUID'
    tasks.load("#{@props.collectionUUID}/#{@props.moduleUUID}",  TASK)


  it 'renders steps', ->
    Testing.renderComponent( Breadcrumbs, props: @props ).then ({dom}) ->
      expect(dom.querySelectorAll('.openstax-breadcrumbs-step:not(.breadcrumb-end)').length).equal(TASK.steps.length)

  it 'calls goToStep callback', ->
    Testing.renderComponent( Breadcrumbs, props: @props ).then ({dom}) =>
      Testing.actions.click dom.querySelector('.openstax-breadcrumbs-step:first-child')
      expect(@props.goToStep).to.have.been.called<commit_msg>fix coach specs<commit_after>{Testing, expect, sinon, _} = require 'shared/test/helpers'

{Breadcrumbs} = require 'breadcrumbs'
TASK = require 'cc/tasks/C_UUID/m_uuid/GET'
tasks = require 'task/collection'

describe 'Breadcrumbs Component', ->
  beforeEach ->
    @props =
      goToStep: sinon.spy()
      moduleUUID: 'm_uuid'
      collectionUUID: 'C_UUID'
    tasks.load("#{@props.collectionUUID}/#{@props.moduleUUID}",  TASK)


  it 'renders steps', ->
    Testing.renderComponent( Breadcrumbs, props: @props ).then ({dom}) ->
      stepOnlyCrumbs = dom.querySelectorAll('.openstax-breadcrumbs-step:not(.breadcrumb-end):not([class$=-intro])')
      expect(stepOnlyCrumbs.length).equal(TASK.steps.length)

  it 'calls goToStep callback', ->
    Testing.renderComponent( Breadcrumbs, props: @props ).then ({dom}) =>
      Testing.actions.click dom.querySelector('.openstax-breadcrumbs-step:first-child')
      expect(@props.goToStep).to.have.been.called
{'fraction_non_alphanumeric': 0.1584640346133045, 'fraction_numerical': 0.0, 'mean_word_length': 4.300859598853868, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4998425', 'n_tokens_mistral': 628, 'n_tokens_neox': 639, 'n_words': 103}