Commit bce8ee69 by Braden MacDonald

Fix bug when deleting first of two recently added blocks

parent 012e6e6f
...@@ -70,80 +70,82 @@ ...@@ -70,80 +70,82 @@
</header> </header>
<article class="xblock-render"> <article class="xblock-render">
<div class="xblock" data-request-token="page-render-token"> <div class="xblock" data-request-token="page-render-token">
<div class="studio-xblock-wrapper" data-locator="locator-component-A1"> <div>
<section class="wrapper-xblock level-element"> <div class="studio-xblock-wrapper" data-locator="locator-component-A1">
<header class="xblock-header"> <section class="wrapper-xblock level-element">
<div class="xblock-header-primary"> <header class="xblock-header">
<div class="header-actions">
<ul class="actions-list">
<li class="action-item action-edit">
<a href="#" class="edit-button action-button"></a>
</li>
<li class="action-item action-duplicate">
<a href="#" class="duplicate-button action-button"></a>
</li>
<li class="action-item action-delete">
<a href="#" class="delete-button action-button"></a>
</li>
<li class="action-item action-drag">
<span data-tooltip="Drag to reorder" class="drag-handle action"></span>
</li>
</ul>
</div>
</div>
</header>
<article class="xblock-render"></article>
</section>
</div>
<div class="studio-xblock-wrapper" data-locator="locator-component-A2">
<section class="wrapper-xblock level-element">
<header class="xblock-header">
<div class="header-actions">
<div class="xblock-header-primary"> <div class="xblock-header-primary">
<ul class="actions-list"> <div class="header-actions">
<li class="action-item action-edit"> <ul class="actions-list">
<a href="#" class="edit-button action-button"></a> <li class="action-item action-edit">
</li> <a href="#" class="edit-button action-button"></a>
<li class="action-item action-duplicate"> </li>
<a href="#" class="duplicate-button action-button"></a> <li class="action-item action-duplicate">
</li> <a href="#" class="duplicate-button action-button"></a>
<li class="action-item action-delete"> </li>
<a href="#" class="delete-button action-button"></a> <li class="action-item action-delete">
</li> <a href="#" class="delete-button action-button"></a>
<li class="action-item action-drag"> </li>
<span data-tooltip="Drag to reorder" class="drag-handle action"></span> <li class="action-item action-drag">
</li> <span data-tooltip="Drag to reorder" class="drag-handle action"></span>
</ul> </li>
</ul>
</div>
</div> </div>
</div> </header>
</header> <article class="xblock-render"></article>
<article class="xblock-render"></article> </section>
</section> </div>
</div> <div class="studio-xblock-wrapper" data-locator="locator-component-A2">
<div class="studio-xblock-wrapper" data-locator="locator-component-A3"> <section class="wrapper-xblock level-element">
<section class="wrapper-xblock level-element"> <header class="xblock-header">
<header class="xblock-header">
<div class="xblock-header-primary">
<div class="header-actions"> <div class="header-actions">
<ul class="actions-list"> <div class="xblock-header-primary">
<li class="action-item action-edit"> <ul class="actions-list">
<a href="#" class="edit-button action-button"></a> <li class="action-item action-edit">
</li> <a href="#" class="edit-button action-button"></a>
<li class="action-item action-duplicate"> </li>
<a href="#" class="duplicate-button action-button"></a> <li class="action-item action-duplicate">
</li> <a href="#" class="duplicate-button action-button"></a>
<li class="action-item action-delete"> </li>
<a href="#" class="delete-button action-button"></a> <li class="action-item action-delete">
</li> <a href="#" class="delete-button action-button"></a>
<li class="action-item action-drag"> </li>
<span data-tooltip="Drag to reorder" class="drag-handle action"></span> <li class="action-item action-drag">
</li> <span data-tooltip="Drag to reorder" class="drag-handle action"></span>
</ul> </li>
</ul>
</div>
</div> </div>
</div> </header>
</header> <article class="xblock-render"></article>
<article class="xblock-render"></article> </section>
</section> </div>
<div class="studio-xblock-wrapper" data-locator="locator-component-A3">
<section class="wrapper-xblock level-element">
<header class="xblock-header">
<div class="xblock-header-primary">
<div class="header-actions">
<ul class="actions-list">
<li class="action-item action-edit">
<a href="#" class="edit-button action-button"></a>
</li>
<li class="action-item action-duplicate">
<a href="#" class="duplicate-button action-button"></a>
</li>
<li class="action-item action-delete">
<a href="#" class="delete-button action-button"></a>
</li>
<li class="action-item action-drag">
<span data-tooltip="Drag to reorder" class="drag-handle action"></span>
</li>
</ul>
</div>
</div>
</header>
<article class="xblock-render"></article>
</section>
</div>
</div> </div>
<div class="add-xblock-component new-component-item adding"></div> <div class="add-xblock-component new-component-item adding"></div>
</div> </div>
...@@ -173,80 +175,82 @@ ...@@ -173,80 +175,82 @@
<article class="xblock-render"> <article class="xblock-render">
<div class="xblock" data-request-token="page-render-token"> <div class="xblock" data-request-token="page-render-token">
<div class="studio-xblock-wrapper" data-locator="locator-component-B1"> <div>
<section class="wrapper-xblock level-element"> <div class="studio-xblock-wrapper" data-locator="locator-component-B1">
<header class="xblock-header"> <section class="wrapper-xblock level-element">
<div class="xblock-header-primary"> <header class="xblock-header">
<div class="header-actions"> <div class="xblock-header-primary">
<ul class="actions-list"> <div class="header-actions">
<li class="action-item action-edit"> <ul class="actions-list">
<a href="#" class="edit-button action-button"></a> <li class="action-item action-edit">
</li> <a href="#" class="edit-button action-button"></a>
<li class="action-item action-duplicate"> </li>
<a href="#" class="duplicate-button action-button"></a> <li class="action-item action-duplicate">
</li> <a href="#" class="duplicate-button action-button"></a>
<li class="action-item action-delete"> </li>
<a href="#" class="delete-button action-button"></a> <li class="action-item action-delete">
</li> <a href="#" class="delete-button action-button"></a>
<li class="action-item action-drag"> </li>
<span data-tooltip="Drag to reorder" class="drag-handle action"></span> <li class="action-item action-drag">
</li> <span data-tooltip="Drag to reorder" class="drag-handle action"></span>
</ul> </li>
</ul>
</div>
</div> </div>
</div> </header>
</header> <article class="xblock-render"></article>
<article class="xblock-render"></article> </section>
</section> </div>
</div> <div class="studio-xblock-wrapper" data-locator="locator-component-B2">
<div class="studio-xblock-wrapper" data-locator="locator-component-B2"> <section class="wrapper-xblock level-element">
<section class="wrapper-xblock level-element"> <header class="xblock-header">
<header class="xblock-header"> <div class="xblock-header-primary">
<div class="xblock-header-primary"> <div class="header-actions">
<div class="header-actions"> <ul class="actions-list">
<ul class="actions-list"> <li class="action-item action-edit">
<li class="action-item action-edit"> <a href="#" class="edit-button action-button"></a>
<a href="#" class="edit-button action-button"></a> </li>
</li> <li class="action-item action-duplicate">
<li class="action-item action-duplicate"> <a href="#" class="duplicate-button action-button"></a>
<a href="#" class="duplicate-button action-button"></a> </li>
</li> <li class="action-item action-delete">
<li class="action-item action-delete"> <a href="#" class="delete-button action-button"></a>
<a href="#" class="delete-button action-button"></a> </li>
</li> <li class="action-item action-drag">
<li class="action-item action-drag"> <span data-tooltip="Drag to reorder" class="drag-handle action"></span>
<span data-tooltip="Drag to reorder" class="drag-handle action"></span> </li>
</li> </ul>
</ul> </div>
</div> </div>
</div> </header>
</header> <article class="xblock-render"></article>
<article class="xblock-render"></article> </section>
</section> </div>
</div> <div class="studio-xblock-wrapper" data-locator="locator-component-B3">
<div class="studio-xblock-wrapper" data-locator="locator-component-B3"> <section class="wrapper-xblock level-element">
<section class="wrapper-xblock level-element"> <header class="xblock-header">
<header class="xblock-header"> <div class="xblock-header-primary">
<div class="xblock-header-primary"> <div class="header-actions">
<div class="header-actions"> <ul class="actions-list">
<ul class="actions-list"> <li class="action-item action-edit">
<li class="action-item action-edit"> <a href="#" class="edit-button action-button"></a>
<a href="#" class="edit-button action-button"></a> </li>
</li> <li class="action-item action-duplicate">
<li class="action-item action-duplicate"> <a href="#" class="duplicate-button action-button"></a>
<a href="#" class="duplicate-button action-button"></a> </li>
</li> <li class="action-item action-delete">
<li class="action-item action-delete"> <a href="#" class="delete-button action-button"></a>
<a href="#" class="delete-button action-button"></a> </li>
</li> <li class="action-item action-drag">
<li class="action-item action-drag"> <span data-tooltip="Drag to reorder" class="drag-handle action"></span>
<span data-tooltip="Drag to reorder" class="drag-handle action"></span> </li>
</li> </ul>
</ul> </div>
</div> </div>
</div> </header>
</header> <article class="xblock-render"></article>
<article class="xblock-render"></article> </section>
</section> </div>
</div> </div>
<div class="add-xblock-component new-component-item adding"></div> <div class="add-xblock-component new-component-item adding"></div>
</div> </div>
......
...@@ -148,6 +148,27 @@ class LibraryEditPageTest(StudioLibraryTest): ...@@ -148,6 +148,27 @@ class LibraryEditPageTest(StudioLibraryTest):
add_component(self.lib_page, "problem", "Multiple Choice") add_component(self.lib_page, "problem", "Multiple Choice")
self.assertTrue(self.lib_page.nav_disabled(position)) self.assertTrue(self.lib_page.nav_disabled(position))
def test_delete_deletes_only_desired_block(self):
"""
Scenario: Ensure that when deleting XBlock only desired XBlock is deleted
Given that I have a library in Studio with no XBlocks
And I create Blank Common Problem XBlock
And I create Checkboxes XBlock
When I delete Blank Problem XBlock
Then Checkboxes XBlock is not deleted
And Blank Common Problem XBlock is deleted
"""
self.assertEqual(len(self.lib_page.xblocks), 0)
add_component(self.lib_page, "problem", "Blank Common Problem")
add_component(self.lib_page, "problem", "Checkboxes")
self.assertEqual(len(self.lib_page.xblocks), 2)
self.assertIn("Blank Common Problem", self.lib_page.xblocks[0].name)
self.assertIn("Checkboxes", self.lib_page.xblocks[1].name)
self.lib_page.click_delete_button(self.lib_page.xblocks[0].locator)
self.assertEqual(len(self.lib_page.xblocks), 1)
problem_block = self.lib_page.xblocks[0]
self.assertIn("Checkboxes", problem_block.name)
@ddt @ddt
class LibraryNavigationTest(StudioLibraryTest): class LibraryNavigationTest(StudioLibraryTest):
......
...@@ -12,9 +12,11 @@ ...@@ -12,9 +12,11 @@
<div class="container-paging-header"></div> <div class="container-paging-header"></div>
<div>
% for item in items: % for item in items:
${item['content']} ${item['content']}
% endfor % endfor
</div>
% if can_add: % if can_add:
<div class="add-xblock-component new-component-item adding"></div> <div class="add-xblock-component new-component-item adding"></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment