diff --git a/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs b/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs index baea0859cb8..0960b9ccd5e 100644 --- a/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs @@ -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(); } } diff --git a/test/DynamoCoreWpfTests/DynamoViewTests.cs b/test/DynamoCoreWpfTests/DynamoViewTests.cs index 66f57f02e8c..1e489261dd3 100644 --- a/test/DynamoCoreWpfTests/DynamoViewTests.cs +++ b/test/DynamoCoreWpfTests/DynamoViewTests.cs @@ -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() {