public void CollapseButtonOnlyEnabledWhenNodeHasUnconnectedPorts()
        {
            graphView.RebuildUI(GraphModel, CommandDispatcher);
            List <Node> nodeList = graphView.Nodes.ToList();

            // Nothing is connected. The collapse button should be enabled.
            Assert.AreEqual(2, nodeList.Count);
            foreach (Node node in nodeList)
            {
                VisualElement collapseButton = node.SafeQ <VisualElement>(name: "collapse-button");
                Assert.False(collapseButton.GetDisabledPseudoState());
            }

            var edge = GraphModel.CreateEdge(m_Node1.GetOutputPorts().First(), m_Node2.GetInputPorts().First());

            graphView.RebuildUI(GraphModel, CommandDispatcher);
            nodeList = graphView.Nodes.ToList();

            // Ports are connected. The collapse button should be disabled.
            Assert.AreEqual(2, nodeList.Count);
            foreach (Node node in nodeList)
            {
                VisualElement collapseButton = node.SafeQ <VisualElement>(name: "collapse-button");
                Assert.True(collapseButton.GetDisabledPseudoState());
            }

            // Disconnect the ports of the 2 nodes.
            GraphModel.DeleteEdge(edge);
            graphView.RebuildUI(GraphModel, CommandDispatcher);
            nodeList = graphView.Nodes.ToList();

            // Once more, nothing is connected. The collapse button should be enabled.
            Assert.AreEqual(2, nodeList.Count);
            foreach (Node node in nodeList)
            {
                VisualElement collapseButton = node.SafeQ <VisualElement>(name: "collapse-button");
                Assert.False(collapseButton.GetDisabledPseudoState());
            }
        }