Skip to content

Commit

Permalink
#7243 Dynamic Matrix - No space between the last and total rows
Browse files Browse the repository at this point in the history
Fixes #7243
  • Loading branch information
novikov82 committed Oct 30, 2023
1 parent 1b7f3d4 commit bb85749
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/react/reactquestion_matrixdropdownbase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class SurveyQuestionMatrixDropdownBase extends SurveyQuestionElementBase

return (
<React.Fragment key={key}>
<MatrixRow model={row} parentMatrix={this.question}>{matrixrow}</MatrixRow>
{(reason == "row-footer") ? <tr>{matrixrow}</tr> : <MatrixRow model={row} parentMatrix={this.question}>{matrixrow}</MatrixRow>}
</React.Fragment>
);
}
Expand Down
20 changes: 20 additions & 0 deletions tests/markup/etalon_matrixdynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ registerMarkupTests(
before: () => StylesManager.applyTheme("defaultV2"),
after: () => StylesManager.applyTheme("default"),
snapshot: "matrixdynamic-defaultV2"
},
{
name: "Test matrixdynamic question (defaultV2) markup with totals",
json: {
"elements": [
{
"type": "matrixdynamic",
"titleLocation": "hidden",
"name": "question1",
"columns": [
{
"name": "Column 1",
"totalType": "count",
"totalFormat": "Count: {0}",
}
]
}
]
},
snapshot: "matrixdynamic-totals"
}
]
);
Expand Down
141 changes: 141 additions & 0 deletions tests/markup/snapshots/matrixdynamic-totals.snap.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<div>
<div>
<table class="sv_q_matrix_dynamic">
<thead>
<tr>
<th class="sv_matrix_cell_header sv_matrix_cell--dropdown">
<span class="sv-string-viewer">Column 1</span>
</th>
<td class="sv_matrix_cell_header sv_matrix_cell--action">
</td>
</tr>
</thead>
<tbody>
<tr class="sv_matrix_row" data-sv-drop-target-matrix-row="testid0row1">
<td class="sv_matrix_cell" colspan="1" data-responsive-title="Column 1" title="Column 1">
<div>
<div>
<div class="sv_select_wrapper">
<div aria-controls="testid0row1cell0i_list" aria-expanded="false" aria-invalid="false" aria-label="Column 1" aria-required="false" class="sv_q_dropdown_control" id="testid0row1cell0i" role="combobox">
<div class="sv_q_dropdown__value">
<input aria-controls="testid0row1cell0i_list" aria-expanded="false" aria-label="Column 1" autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0row1cell0i_0" inputmode="text" placeholder="Select..." role="combobox" type="text">
</div>
<div class="sv_q_dropdown_clean-button" style="display:none;">
<svg aria-label="Clear" class="sv_q_dropdown_clean-button-svg sv-svg-icon" role="img">
<use xlink:href="#icon-clear_16x16" class="">
</use>
<title class="">Clear</title>
</svg>
</div>
</div>
<div>
<div class="sv-dropdown-popup sv-popup sv-popup--dropdown sv-single-select-list" style="display:none;" tabindex="-1">
<div class="sv-popup__container">
<div class="sv-popup__shadow">
<div class="sv-popup__body-content">
<div class="sv-popup__scrolling-content">
<div class="sv-popup__content">
<div class="sv-list__container">
<div class="sv-list__empty-container">
<div aria-label="No data to display" class="sv-list__empty-text">No data to display</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</td>
<td class="sv_matrix_cell sv_matrix_cell_actions" colspan="1" data-responsive-title="" title="">
<div class="sv-action-bar sv-action-bar--default-size-mode">
<div class="sv-action" id="remove-row">
<div class="sv-action__content">
<button class="sv_matrix_dynamic_button" type="button">
<span class="sv-string-viewer">Remove</span>
<span>
</span>
</button>
</div>
</div>
</div>
</td>
</tr>
<tr class="sv_matrix_row" data-sv-drop-target-matrix-row="testid0row3">
<td class="sv_matrix_cell" colspan="1" data-responsive-title="Column 1" title="Column 1">
<div>
<div>
<div class="sv_select_wrapper">
<div aria-controls="testid0row3cell0i_list" aria-expanded="false" aria-invalid="false" aria-label="Column 1" aria-required="false" class="sv_q_dropdown_control" id="testid0row3cell0i" role="combobox">
<div class="sv_q_dropdown__value">
<input aria-controls="testid0row3cell0i_list" aria-expanded="false" aria-label="Column 1" autocomplete="off" class="sv_q_dropdown__filter-string-input" id="testid0row3cell0i_0" inputmode="text" placeholder="Select..." role="combobox" type="text">
</div>
<div class="sv_q_dropdown_clean-button" style="display:none;">
<svg aria-label="Clear" class="sv_q_dropdown_clean-button-svg sv-svg-icon" role="img">
<use xlink:href="#icon-clear_16x16" class="">
</use>
<title class="">Clear</title>
</svg>
</div>
</div>
<div>
<div class="sv-dropdown-popup sv-popup sv-popup--dropdown sv-single-select-list" style="display:none;" tabindex="-1">
<div class="sv-popup__container">
<div class="sv-popup__shadow">
<div class="sv-popup__body-content">
<div class="sv-popup__scrolling-content">
<div class="sv-popup__content">
<div class="sv-list__container">
<div class="sv-list__empty-container">
<div aria-label="No data to display" class="sv-list__empty-text">No data to display</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</td>
<td class="sv_matrix_cell sv_matrix_cell_actions" colspan="1" data-responsive-title="" title="">
<div class="sv-action-bar sv-action-bar--default-size-mode">
<div class="sv-action" id="remove-row">
<div class="sv-action__content">
<button class="sv_matrix_dynamic_button" type="button">
<span class="sv-string-viewer">Remove</span>
<span>
</span>
</button>
</div>
</div>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td class="sv_matrix_cell" colspan="1" data-responsive-title="Column 1" title="Column 1">
<div>
<div>Count: 0</div>
</div>
</td>
</tr>
</tfoot>
</table>
</div>
<div class="sv_q_footer">
<button class="sv_matrix_dynamic_button" type="button">
<span class="sv-string-viewer">Add Row</span>
<span>
</span>
</button>
</div>
</div>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions visualRegressionTests/tests/defaultV2/matrixdynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,31 @@ frameworks.forEach(framework => {
await takeElementScreenshot("matrixdynamic-show-in-multiple-columns.png", matrixdynamicRoot, t, comparer);
});
});
test("Check Matrixdynamic with totals", async (t) => {
await wrapVisualTest(t, async (t, comparer) => {
await t.resizeWindow(1280, 1100);
await initSurvey(framework, {
showQuestionNumbers: "off",
elements: [
{
type: "matrixdynamic",
name: "orderList",
addRowText: "Add new item",
columns: [
{
name: "phone_model",
title: "Phone model",
totalType: "count",
totalFormat: "Items count: {0}",
}
]
}
]
});

const matrixdynamicRoot = Selector(".sd-question");
await resetFocusToBody();
await takeElementScreenshot("matrixdynamic-with-totals.png", matrixdynamicRoot, t, comparer);
});
});
});

0 comments on commit bb85749

Please sign in to comment.