Skip to content

Instantly share code, notes, and snippets.

@knomedia
Created January 15, 2014 16:11
Show Gist options
  • Save knomedia/8439056 to your computer and use it in GitHub Desktop.
Save knomedia/8439056 to your computer and use it in GitHub Desktop.
define [
'ember'
'../start_app'
'../../components/assignment_group_grades_component'
'../shared_ajax_fixtures'
], (Ember, startApp, AGGrades, fixtures) ->
{ContainerView, run} = Ember
fixtures.create()
originalWeightingScheme = null
originalGradingStandard = null
groupScores =
assignment_group_1:
possible: 1000.111
score: 85.115
submission_count: 10
submissions: []
weight: 90
module 'assignment_group_grades_component',
setup: ->
#App = startApp()
@component = AGGrades.create()
#@component = App.AssignmentGroupGradesComponent.create()
@component.reopen
gradingStandard: (->
originalGradingStandard = this._super
undefined
).property()
weightingScheme: (->
originalWeightingScheme = this._super
"percent"
).property()
run =>
@assignment_group = Em.copy(fixtures.assignment_groups, true).findBy('id', '1')
@student = Ember.Object.create Ember.copy groupScores
@component.setProperties
student: @student
ag: @assignment_group
@component.append()
teardown: ->
run =>
@component.destroy()
test 'values', ->
deepEqual @component.get('values'), groupScores.assignment_group_1
test 'points', ->
expected = "85.12 / 1000.11"
equal @component.get('points'), expected
test 'percent', ->
expected = "8.5%"
equal @component.get('percent'), expected
test 'scoreDetail', ->
expected = "(85.12 / 1000.11)"
equal @component.get('scoreDetail'), expected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment