<%
if project && !project.blank?
plans = Internal.issues.findOpenActionPlans(project)
- first_plan = plans[0]
plan_options = ""
unless plans.empty?
- plan_options = options_for_select(plans.map { |plan|
+ first_plan = plans[0]
+ options = plans.map { |plan|
if plan.deadLine
label = "#{h plan.name} (#{format_date(plan.deadLine)})"
else
label = h plan.name
end
[label, plan.key]
- }, first_plan.key)
+ }
+ options.unshift([escape_javascript(message('issue.unplan.submit')), ''])
+ plan_options = options_for_select(options, first_plan.key)
end
%>
<div class="modal-field">
verify(issueUpdater).plan(eq(issue), eq(planKey), any(IssueChangeContext.class));
}
+ @Test
+ public void should_execute_on_null_action_plan(){
+ Map<String, Object> properties = newHashMap();
+ DefaultIssue issue = mock(DefaultIssue.class);
+
+ Action.Context context = mock(Action.Context.class);
+ when(context.issue()).thenReturn(issue);
+
+ action.execute(properties, context);
+ verify(issueUpdater).plan(eq(issue), eq((String) null), any(IssueChangeContext.class));
+ }
+
+ @Test
+ public void should_execute_on_empty_action_plan(){
+ Map<String, Object> properties = newHashMap();
+ properties.put("plan", "");
+ DefaultIssue issue = mock(DefaultIssue.class);
+
+ Action.Context context = mock(Action.Context.class);
+ when(context.issue()).thenReturn(issue);
+
+ action.execute(properties, context);
+ verify(issueUpdater).plan(eq(issue), eq(""), any(IssueChangeContext.class));
+ }
+
@Test
public void should_verify(){
String planKey = "ABCD";