Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
maxlength
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
maxlength
Merge requests
!21
Issue
#3296289
: Only show Summary maxlength options if Summary input is enabled
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3296289
: Only show Summary maxlength options if Summary input is enabled
issue/maxlength-3296289:3296289-only-show-summary
into
2.0.x
Overview
0
Commits
5
Pipelines
0
Changes
2
Open
juancec
requested to merge
issue/maxlength-3296289:3296289-only-show-summary
into
2.0.x
2 years ago
Overview
0
Commits
5
Pipelines
0
Changes
2
Expand
0
0
Merge request reports
Compare
2.0.x
version 5
ed3dec0f
2 years ago
version 4
90df86c4
2 years ago
version 3
f6a243d7
2 years ago
version 2
e2dd454e
2 years ago
version 1
dee98c9f
2 years ago
2.0.x (HEAD)
and
latest version
latest version
8e6150ad
5 commits,
2 years ago
version 5
ed3dec0f
5 commits,
2 years ago
version 4
90df86c4
4 commits,
2 years ago
version 3
f6a243d7
3 commits,
2 years ago
version 2
e2dd454e
2 commits,
2 years ago
version 1
dee98c9f
1 commit,
2 years ago
2 files
+
150
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
tests/src/FunctionalJavascript/MaxLenghtSummaryStatusTest.php
0 → 100644
+
148
−
0
Options
<?php
namespace
Drupal\Tests\maxlength\FunctionalJavascript
;
use
Drupal\Core\Entity\Entity\EntityFormDisplay
;
use
Drupal\FunctionalJavascriptTests\WebDriverTestBase
;
/**
* Tests the custom widget support.
*
* @group maxlength
*/
class
MaxLenghtSummaryStatusTest
extends
WebDriverTestBase
{
/**
* {@inheritdoc}
*/
protected
static
$modules
=
[
'node'
,
'field'
,
'field_ui'
,
'maxlength'
,
];
/**
* {@inheritdoc}
*/
protected
$defaultTheme
=
'classy'
;
/**
* {@inheritdoc}
*/
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
drupalCreateContentType
([
'type'
=>
'article'
,
'name'
=>
'Article'
]);
EntityFormDisplay
::
load
(
'node.article.default'
)
->
setComponent
(
'body'
,
[
'type'
=>
'text_textarea_with_summary'
,
'third_party_settings'
=>
[
'maxlength'
=>
[
'maxlength_js'
=>
123
,
'maxlength_js_summary'
=>
123
],
],
])
->
save
();
}
/**
* Tests that a if summary gets enabled.
*/
public
function
testMaxlengthIfSummaryIsEnabled
()
{
$this
->
drupalLogin
(
$this
->
drupalCreateUser
([
'administer users'
,
'administer permissions'
,
'administer node form display'
,
'administer node fields'
,
]));
// Setting up the url to edit the field.
$this
->
drupalGet
(
'admin/structure/types/manage/article/fields/node.article.body'
);
$page
=
$this
->
getSession
()
->
getPage
();
$this
->
getSession
()
->
wait
(
1000
);
// Uncheck the summary display.
$page
->
findField
(
'edit-settings-display-summary'
)
->
check
();
$this
->
assertSession
()
->
checkboxChecked
(
'edit-settings-display-summary'
);
$page
->
pressButton
(
'Save'
);
// Verify the if fields are there.
$this
->
drupalGet
(
'admin/structure/types/manage/article/form-display'
);
$page
->
pressButton
(
'edit-fields-body-settings-edit'
);
$this
->
getSession
()
->
wait
(
1000
);
$this
->
assertSession
()
->
fieldExists
(
'Summary count down message'
);
$this
->
assertSession
()
->
fieldExists
(
'Summary maximum length'
);
$page
->
pressButton
(
'Update'
);
$this
->
getSession
()
->
wait
(
1000
);
$this
->
assertSession
()
->
responseContains
(
'Maximum length: 123'
);
$this
->
assertSession
()
->
responseContains
(
'Maximum summary length: 123'
);
}
/**
* Tests that a if summary gets disabled.
*/
public
function
testMaxlengthIfSummaryIsDisabled
()
{
$this
->
drupalLogin
(
$this
->
drupalCreateUser
([
'administer users'
,
'administer permissions'
,
'administer node form display'
,
'administer node fields'
,
]));
// Setting up the url to edit the field.
$this
->
drupalGet
(
'admin/structure/types/manage/article/fields/node.article.body'
);
$page
=
$this
->
getSession
()
->
getPage
();
$this
->
getSession
()
->
wait
(
1000
);
// Uncheck the summary display.
$page
->
findField
(
'edit-settings-display-summary'
)
->
uncheck
();
$this
->
assertSession
()
->
checkboxNotChecked
(
'edit-settings-display-summary'
);
$page
->
pressButton
(
'Save'
);
// Verify the fields.
$this
->
drupalGet
(
'admin/structure/types/manage/article/form-display'
);
$page
->
pressButton
(
'edit-fields-body-settings-edit'
);
$this
->
getSession
()
->
wait
(
1000
);
$this
->
assertSession
()
->
fieldNotExists
(
'Summary count down message'
);
$this
->
assertSession
()
->
fieldNotExists
(
'Summary maximum length'
);
$page
->
pressButton
(
'Update'
);
$this
->
getSession
()
->
wait
(
1000
);
$this
->
assertSession
()
->
responseNotContains
(
'Maximum summary length: 123'
);
}
/**
* Tests that check the widget summary.
*/
public
function
testMaxlengthIfWidgetSummaryIsDisabled
()
{
$this
->
drupalLogin
(
$this
->
drupalCreateUser
([
'administer users'
,
'administer permissions'
,
'administer node form display'
,
'administer node fields'
,
]));
// This test still unfinished the idea is simple when it press update.
// field plugin summary shouldnt have Maximum summary length: 123.
$this
->
drupalGet
(
'admin/structure/types/manage/article/fields/node.article.body'
);
$page
=
$this
->
getSession
()
->
getPage
();
$this
->
getSession
()
->
wait
(
1000
);
$page
->
findField
(
'edit-settings-display-summary'
)
->
check
();
$this
->
assertSession
()
->
checkboxChecked
(
'edit-settings-display-summary'
);
$page
->
pressButton
(
'Save'
);
$this
->
drupalGet
(
'admin/structure/types/manage/article/form-display'
);
$page
->
pressButton
(
'edit-fields-body-settings-edit'
);
$this
->
getSession
()
->
wait
(
1000
);
$this
->
assertSession
()
->
fieldExists
(
'Summary count down message'
);
$this
->
assertSession
()
->
fieldExists
(
'Summary maximum length'
);
$page
->
pressButton
(
'Update'
);
$this
->
getSession
()
->
wait
(
1000
);
$this
->
assertSession
()
->
responseContains
(
'Maximum summary length: 123'
);
$this
->
drupalGet
(
'admin/structure/types/manage/article/fields/node.article.body'
);
$page
->
findField
(
'edit-settings-display-summary'
)
->
uncheck
();
$this
->
assertSession
()
->
checkboxNotChecked
(
'edit-settings-display-summary'
);
$page
->
pressButton
(
'Save'
);
$this
->
drupalGet
(
'admin/structure/types/manage/article/form-display'
);
$page
->
pressButton
(
'edit-fields-body-settings-edit'
);
$this
->
getSession
()
->
wait
(
1000
);
$this
->
assertSession
()
->
fieldNotExists
(
'Summary count down message'
);
$this
->
assertSession
()
->
fieldNotExists
(
'Summary maximum length'
);
$page
->
pressButton
(
'Update'
);
$this
->
getSession
()
->
wait
(
1000
);
$this
->
assertSession
()
->
responseNotContains
(
'Maximum summary length: 123'
);
}
}
Loading