based on some simple tests, it appears window.confirm gets rewired to
simply return true in the headless context by default.


On Thu, Feb 20, 2014 at 11:58 AM, Greg Price <notifications@github.com>wrote:

> In
> common/static/coffee/spec/discussion/view/response_comment_view_spec.coffee:
>
> > +                    (if isSuccess then params.success else params.error) {}
> > +                    {always: ->}
> > +            )
> > +
> > +        it 'requires confirmation before deleting', ->
> > +            spyOn(window, "confirm").andReturn(false)
> > +            spyOn(@comment, "remove")
> > +            @view._delete(@event)
> > +            expect(window.confirm).toHaveBeenCalled()
> > +            expect(@comment.remove).not.toHaveBeenCalled()
> > +
> > +        it 'removes the deleted comment object', ->
> > +            spyOn(@comment, "remove")
> > +            spyOn(@view.$el, "remove")
> > +            setAjaxResult(true)
> > +            @view._delete(@event)
>
> How does this work without spying on confirm?
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/edx/edx-platform/pull/2646/files#r9913873>
> .
>