小编Mat*_*iuk的帖子

如何测试 UIAlertController

我正在测试一个提供 UIAlertController 的函数,但测试一直失败。这是函数的样子:

func presentBuyingErrorDialogue() {
  let alert = UIAlertController(
    title: "Warning",
    message: "Error purchasing item, please retry this action. If that doesn't help, try restarting or reinstalling the app.",
    preferredStyle: .alert
  )
  let okButton = UIAlertAction(title: "OK", style: .default)
  alert.addAction(okButton)
  self.present(alert, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)

由于此函数位于名为 ShopViewController 的类中,因此我假设测试此函数的正确方法是调用该函数shopViewController.presentBuyingErrorDiaologue()然后使用XCTAssertTrue(shopViewController.presentedViewController is UIAlertController). 但是,当我运行测试时,断言语句失败。测试 UIAlertController 是呈现视图的正确方法是什么?

ios xctest swift uialertcontroller

6
推荐指数
2
解决办法
5352
查看次数

在更改视图网格 fullcalendar v4 上拖放后,带有 rrule 插件的事件未更新

我目前正在使用 rrule 插件开发 Fullcalendar v4

我有这个代码

var calendarEl = document.getElementById('calendardemo');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: ['interaction', 'dayGrid', 'timeGrid', 'momentTimezone', 'rrule', 'list'],
header: {
     left: 'prev,next today',
     center: 'title',
     right: 'dayGridMonth,timeGridWeek,timeGridDay'
},
editable: true,
events: [
{ // standard property
     title: 'This is sample event',
     start: '2019-12-29', 
     end: '2019-12-31'
},
{
     title: 'event with rrule plugin',
     rrule: {
          freq: 'weekly',
          interval: 5,
          byweekday: [ 'mo', 'fr' ],
          dtstart: '2019-12-29T10:30:00',
          until: '2020-12-31'
     }
}
]
});
calendar.render();

Run Code Online (Sandbox Code Playgroud)

请注意:

{ // …
Run Code Online (Sandbox Code Playgroud)

javascript rrule fullcalendar fullcalendar-4

6
推荐指数
1
解决办法
197
查看次数