Skip to content

Commit 19710ef

Browse files
committed
Add test for loading blank workspaces. .findWhere returns [0] item or None.
1 parent 4b8c94b commit 19710ef

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tmuxp/testsuite/test_workspacebuilder.py

+6
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,12 @@ def test_blank_pane_count(self):
280280
builder = WorkspaceBuilder(sconf=test_config)
281281
builder.build(session=self.session)
282282

283+
window1 = self.session.findWhere({'window_name': 'Blank pane test'})
284+
self.assertEqual(len(window1._panes), 6)
285+
286+
window1 = self.session.findWhere({'window_name': 'Empty string (return)'})
287+
self.assertEqual(len(window1._panes), 3)
288+
283289
self.assertEqual(self.session, builder.session)
284290

285291

tmuxp/util.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ def findWhere(self, attrs):
150150
.. _underscore.js: http://underscorejs.org/
151151
152152
"""
153-
return self.where(attrs, True)
153+
return self.where(attrs)[0] or None
154154

155155
def where(self, attrs, first=False):
156-
"""Return objects matching child objects properties>
156+
"""Return objects matching child objects properties.
157157
158158
Based on `.where()`_ from `underscore.js`_.
159159

0 commit comments

Comments
 (0)