当前位置: 动力学知识库 > 问答 > 编程问答 >

jquery - How to write karma test case for modal dialog?

问题描述:

I have the modal like this

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">

<div class="modal-dialog" role="document">

<div class="modal-content">

<div class="modal-header">

<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>

<h4 class="modal-title" id="myModalLabel">{{modal_header}}</h4>

</div>

<div class="modal-body">

{{modal_msg}}

</div>

<div class="modal-footer">

<button type="button" class="btn btn-default" data-dismiss="modal">ok</button>

</div>

</div>

</div>

</div>

And i'm setting the value for modal_header and modal_message from rootscope in angularjs like below.

rootScope.modal_msg='test';

rootScope.modal_header = 'header';

$('#myModal').modal({backdrop: 'static', keyboard: false});

If i hit some service it is success or fail, depends on that i displaying the message. This is working fine, but i want to write unit test case for test these modal dialog, i searched lot of things, but all are different they are using modalinstance.

please help me, how can i write test case for this.

Thanks in advance.

分享给朋友:
您可能感兴趣的文章:
随机阅读: