bootbox不等待确认

时间:2016-03-15 06:40:51

标签: php jquery bootbox

我是使用bootbox插件的新手..

当我点击删除按钮时,它不会等待启动箱确认..它只是执行我的删除代码......

这是我的代码:

JQUERY

public class UserServiceTest {

    @InjectMocks
    UserService userService;

    @Mock
    UserDao mockUserRepository;

    @Before
    public void setUp(){
        MockitoAnnotations.initMocks(this);
    }

    @Test
    public void testFindUser(){
        // Given
        User dummyUser = new User();
        when(mockUserRepository.findByLoginAndPassword(anyString(), anyString()).thenReturn(dummyUser);

        // When
        User result = userService.findUser("first", "teste");

        // Then
        // you are expecting service to return whatever returned by repo
        assertThat("result", result, is(sameInstance(dummUser)));

        // you are expecting repo to be called once with correct param
        verify(mockUserRepository).findByLoginAndPassword("first", "teste");
    }
}

HTML

$('.cmd_delete_location').click(function(e){
$this=$(this);
bootbox.confirm("Are you sure?", function(result){
    if(result)
    {
        form = $this.parent();
        form.submit();
    }
});
});

PHP

 <form method="post">
    <button type="submit" class="btn btn-success" title="Update Location" value="<?=$loc['LocationID']?>" name="cmd_update_location"><i class="fa fa-edit fa-fw"></i></button>
    <button type="submit" class="btn btn-danger cmd_delete_location" title="Delete Location" value="<?=$loc['LocationID']?>" name="cmd_delete_location"><i class="fa fa-trash fa-fw"></i></button>
 </form>

提前感谢..

0 个答案:

没有答案
相关问题