Skip to content

Commit

Permalink
DYN-7138 Save as and Save buttons should be enabled after closing a g…
Browse files Browse the repository at this point in the history
…raph while editing a custom node (#15579)
  • Loading branch information
zeusongit authored Oct 31, 2024
1 parent 330fddb commit 041ab8a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3196,8 +3196,11 @@ private void CloseHomeWorkspace(object parameter)
// If after closing the HOME workspace, and there are no other custom
// workspaces opened at the time, then we should show the start page.
this.ShowStartPage = (Model.Workspaces.Count() <= 1);
if (this.ShowStartPage)
{
OnEnableShortcutBarItems(false);
}
RunSettings.ForceBlockRun = false;
OnEnableShortcutBarItems(false);
OnRequestCloseHomeWorkSpace();
}
}
Expand Down
28 changes: 28 additions & 0 deletions test/DynamoCoreWpfTests/DynamoViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,34 @@ public void OpeningWorkspaceWithTclsrustWarning()
DynamoModel.IsTestMode = true;
}

[Test]
public void TestHomeWorkspaceClosedBeforeCustomNode()
{
Open(@"core\CustomNodes\TestAdd.dyn");

Open(@"core\CustomNodes\add.dyf");

ViewModel.UIDispatcher.Invoke(new Action(() =>
{
DynamoModel.SwitchTabCommand switchCommand =
new DynamoModel.SwitchTabCommand(0);

ViewModel.ExecuteCommand(switchCommand);
}));
Assert.AreEqual(ViewModel.Model.Workspaces.Count(), 2);

DynamoModel.IsTestMode = false;
ViewModel.CloseHomeWorkspaceCommand.Execute(null);
DynamoModel.IsTestMode = true;

//the workspace count is still 2, since the homeworkspace was replaced by default workspace,
//and second is custom workspace that is still open.
Assert.AreEqual(ViewModel.Model.Workspaces.Count(), 2);

//assert that save button is still enabled
Assert.IsTrue(View.saveButton.IsEnabled);
}

[Test]
public void ElementBinding_SaveAs()
{
Expand Down

0 comments on commit 041ab8a

Please sign in to comment.