Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#600 Breaking Dropdown Action Toggle and Quick Action Item require .component-action #725

Merged
merged 20 commits into from
Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b29a0b6
Breaking: (Fixes #600) Removed colors from Dropdown Action and Quick …
pat270 Feb 23, 2018
85bcf74
Update: (#600) `.btn-unstyled` to work with `.btn-sm` and `.btn-lg`
pat270 Feb 24, 2018
d225ac8
Site: (#600) Dropdown update `.dropdown-toggle` markup and add exampl…
pat270 Feb 24, 2018
236ccd2
Add triggerClasses API in ClayActionsDropdown | Fixes #600
matuzalemsteles Mar 1, 2018
580f3c4
Add tests with triggerClasses in ClayActionsDropdown | Fixes #600
matuzalemsteles Mar 1, 2018
ddf37a8
Update ClayList to use component-action | Fixes #600
matuzalemsteles Mar 1, 2018
2dc8e61
Regen ClayList snapshots | Fixes #600
matuzalemsteles Mar 1, 2018
af9ab9f
Regen ClayActionsDropdown snapshots | Fixes #600
matuzalemsteles Mar 1, 2018
3700b9e
Update ClayTable to use component-action | Fixes #600
matuzalemsteles Mar 1, 2018
e3cd1e8
Regen ClayTable snapshots | Fixes #600
matuzalemsteles Mar 1, 2018
5780cb9
Update ClayCard to use component-action | Fixes #600
matuzalemsteles Mar 1, 2018
fbc4d77
Regen ClayCard snapshots | Fixes #600
matuzalemsteles Mar 1, 2018
a3f9522
Update ClayManagementToolbar to use component-action | Fixes #600
matuzalemsteles Mar 1, 2018
28e3927
Regen ClayManagementToolbar snapshots | Fixes #600
matuzalemsteles Mar 1, 2018
8dfec34
Create task regenerateFixturesExpected
matuzalemsteles Mar 1, 2018
917f16c
regen Fixtures expected | Fixes #600
matuzalemsteles Mar 1, 2018
1a05ee3
SF | Fixes #600
matuzalemsteles Mar 1, 2018
a362755
Remove component-action on the ClayManagementToolbar | Fixes #600
matuzalemsteles Mar 5, 2018
04826fa
Regen ClayManagementToolbar snapshots | Fixes #600
matuzalemsteles Mar 5, 2018
bd3ad15
regen Fixtures expected | Fixes #600
matuzalemsteles Mar 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/clay-card/src/ClayCardBase.soy
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
{call ClayActionsDropdown.render}
{param items: $actionItems /}
{param spritemap: $spritemap /}
{param triggerClasses: 'component-action' /}
{/call}
</div>
{/if}
Expand Down
1 change: 1 addition & 0 deletions packages/clay-card/src/ClayHorizontalCard.soy
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
{call ClayActionsDropdown.render}
{param items: $actionItems /}
{param spritemap: $spritemap /}
{param triggerClasses: 'component-action' /}
{/call}
</div>
{/if}
Expand Down
1 change: 1 addition & 0 deletions packages/clay-card/src/ClayUserCard.soy
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
{call ClayActionsDropdown.render}
{param items: $actionItems /}
{param spritemap: $spritemap /}
{param triggerClasses: 'component-action' /}
{/call}
</div>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`ClayFileCard should render a ClayFileCard with actionItems 1`] = `
</div>
<div class="autofit-col">
<div class="dropdown dropdown-action">
<button aria-expanded="false" aria-haspopup="true" aria-label="toggle" class="dropdown-toggle btn btn-unstyled" type="button">
<button aria-expanded="false" aria-haspopup="true" aria-label="toggle" class="dropdown-toggle btn component-action btn-unstyled" type="button">
<svg aria-hidden="true" class="lexicon-icon lexicon-icon-ellipsis-v" focusable="false">
<title>ellipsis-v</title>
<use xlink:href="icons.svg#ellipsis-v"></use>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ exports[`ClayHorizontalCard should render a ClayHorizontalCard with actionItems
</div>
<div class="autofit-col">
<div class="dropdown dropdown-action">
<button aria-expanded="false" aria-haspopup="true" aria-label="toggle" class="dropdown-toggle btn btn-unstyled" type="button">
<button aria-expanded="false" aria-haspopup="true" aria-label="toggle" class="dropdown-toggle btn component-action btn-unstyled" type="button">
<svg aria-hidden="true" class="lexicon-icon lexicon-icon-ellipsis-v" focusable="false">
<title>ellipsis-v</title>
<use xlink:href="icons.svg#ellipsis-v"></use>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`ClayImageCard should render a ClayImageCard with actionItems 1`] = `
</div>
<div class="autofit-col">
<div class="dropdown dropdown-action">
<button aria-expanded="false" aria-haspopup="true" aria-label="toggle" class="dropdown-toggle btn btn-unstyled" type="button">
<button aria-expanded="false" aria-haspopup="true" aria-label="toggle" class="dropdown-toggle btn component-action btn-unstyled" type="button">
<svg aria-hidden="true" class="lexicon-icon lexicon-icon-ellipsis-v" focusable="false">
<title>ellipsis-v</title>
<use xlink:href="icons.svg#ellipsis-v"></use>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`ClayUserCard should render a ClayUserCard with actionItems 1`] = `
</div>
<div class="autofit-col">
<div class="dropdown dropdown-action">
<button aria-expanded="false" aria-haspopup="true" aria-label="toggle" class="dropdown-toggle btn btn-unstyled" type="button">
<button aria-expanded="false" aria-haspopup="true" aria-label="toggle" class="dropdown-toggle btn component-action btn-unstyled" type="button">
<svg aria-hidden="true" class="lexicon-icon lexicon-icon-ellipsis-v" focusable="false">
<title>ellipsis-v</title>
<use xlink:href="icons.svg#ellipsis-v"></use>
Expand Down

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions packages/clay-dropdown/src/ClayActionsDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ ClayActionsDropdown.STATE = {
* @default undefined
*/
spritemap: Config.string().required(),

/**
* CSS classes to be applied to the trigger element.
* @instance
* @memberof ClayActionsDropdown
* @type {?string|undefined}
* @default undefined
*/
triggerClasses: Config.string(),
};

defineWebComponent('clay-actions-dropdown', ClayActionsDropdown);
Expand Down
60 changes: 31 additions & 29 deletions packages/clay-dropdown/src/ClayActionsDropdown.soy
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,39 @@
{@param? helpText: string}
{@param? id: string}
{@param? itemsIconAlignment: string}
{@param? triggerClasses: string}

{let $dropdownElementClasses kind="text"}
dropdown-action
{if $elementClasses}
{sp}{$elementClasses}
{/if}
{/let}
{let $dropdownElementClasses kind="text"}
dropdown-action
{if $elementClasses}
{sp}{$elementClasses}
{/if}
{/let}

{let $trigger kind="html"}
{call ClayIcon.render}
{param spritemap: $spritemap /}
{param symbol: 'ellipsis-v' /}
{/call}
{/let}
{let $trigger kind="html"}
{call ClayIcon.render}
{param spritemap: $spritemap /}
{param symbol: 'ellipsis-v' /}
{/call}
{/let}

{call ClayDropdownBase.render}
{param button: $button /}
{param caption: $caption /}
{param disabled: $disabled /}
{param elementClasses: $dropdownElementClasses /}
{param events: [
'buttonClicked': $_handleButtonClick,
'itemClicked': $_handleItemClick
]/}
{param expanded: $expanded /}
{param helpText: $helpText /}
{param id: $id /}
{param items: $items /}
{param itemsIconAlignment: $itemsIconAlignment /}
{param label: $trigger /}
{param ref: 'dropdown' /}
{param spritemap: $spritemap /}
{/call}
{param button: $button /}
{param caption: $caption /}
{param disabled: $disabled /}
{param elementClasses: $dropdownElementClasses /}
{param events: [
'buttonClicked': $_handleButtonClick,
'itemClicked': $_handleItemClick
]/}
{param expanded: $expanded /}
{param helpText: $helpText /}
{param id: $id /}
{param items: $items /}
{param itemsIconAlignment: $itemsIconAlignment /}
{param label: $trigger /}
{param ref: 'dropdown' /}
{param spritemap: $spritemap /}
{param triggerClasses: $triggerClasses /}
{/call}
{/template}
76 changes: 38 additions & 38 deletions packages/clay-dropdown/src/ClayDropdown.soy
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,46 @@
{@param? triggerClasses: string}
{@param? triggerSize: string}

{let $trigger kind="html"}
{if $icon}
{call ClayIcon.render}
{param elementClasses: $label ? 'inline-item inline-item-before' : '' /}
{param spritemap: $spritemap /}
{param symbol: $icon /}
{/call}
{/if}
{let $trigger kind="html"}
{if $icon}
{call ClayIcon.render}
{param elementClasses: $label ? 'inline-item inline-item-before' : '' /}
{param spritemap: $spritemap /}
{param symbol: $icon /}
{/call}
{/if}

{if $label}
{$label}
{/if}
{if $label}
{$label}
{/if}

{if not $icon}
{call ClayIcon.render}
{param elementClasses: 'inline-item inline-item-after' /}
{param spritemap: $spritemap /}
{param symbol: 'caret-bottom' /}
{/call}
{/if}
{/let}
{if not $icon}
{call ClayIcon.render}
{param elementClasses: 'inline-item inline-item-after' /}
{param spritemap: $spritemap /}
{param symbol: 'caret-bottom' /}
{/call}
{/if}
{/let}

{call ClayDropdownBase.render}
{param button: $button /}
{param disabled: $disabled /}
{param elementClasses: $elementClasses /}
{param events: [
'buttonClicked': $_handleButtonClick,
'itemClicked': $_handleItemClick
]/}
{param expanded: $expanded /}
{param id: $id /}
{param items: $items /}
{param itemsIconAlignment: $itemsIconAlignment /}
{param label: $trigger /}
{param ref: 'dropdown' /}
{param searchable: $searchable /}
{param spritemap: $spritemap /}
{param style: $style /}
{param triggerClasses: $triggerClasses /}
{param triggerSize: $triggerSize /}
{/call}
{param button: $button /}
{param disabled: $disabled /}
{param elementClasses: $elementClasses /}
{param events: [
'buttonClicked': $_handleButtonClick,
'itemClicked': $_handleItemClick
]/}
{param expanded: $expanded /}
{param id: $id /}
{param items: $items /}
{param itemsIconAlignment: $itemsIconAlignment /}
{param label: $trigger /}
{param ref: 'dropdown' /}
{param searchable: $searchable /}
{param spritemap: $spritemap /}
{param style: $style /}
{param triggerClasses: $triggerClasses /}
{param triggerSize: $triggerSize /}
{/call}
{/template}
12 changes: 12 additions & 0 deletions packages/clay-dropdown/src/__tests__/ClayActionsDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ describe('ClayActionsDropdown', function() {
expect(clayActionsDropdown).toMatchSnapshot();
});

it('should render an actions dropdown with triggerClasses', () => {
clayActionsDropdown = new ClayActionsDropdown({
id: 'myId',
items: items,
label: 'Trigger',
spritemap: 'icons.svg',
triggerClasses: 'component-action',
});

expect(clayActionsDropdown).toMatchSnapshot();
});

it('should render a disabled dropdown', () => {
clayActionsDropdown = new ClayActionsDropdown({
disabled: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,49 @@ exports[`ClayActionsDropdown should render an actions dropdown with id 1`] = `
</div>
`;
exports[`ClayActionsDropdown should render an actions dropdown with triggerClasses 1`] = `
<div class="dropdown dropdown-action" id="myId">
<button aria-expanded="false" aria-haspopup="true" aria-label="toggle" class="dropdown-toggle btn component-action btn-unstyled" type="button">
<svg aria-hidden="true" class="lexicon-icon lexicon-icon-ellipsis-v" focusable="false">
<title>ellipsis-v</title>
<use xlink:href="icons.svg#ellipsis-v"></use>
</svg>
</button>
</div>
<div class="dropdown-menu" ref="menu">
<ul class="list-unstyled">
<li>
<a class=" dropdown-item" href="#1">Edit</a>
</li>
<li>
<a class=" dropdown-item" href="#1">Preview</a>
</li>
<li aria-hidden="true" class="dropdown-divider" role="presentation"></li>
<li>
<a class=" dropdown-item" href="#1">Expire</a>
</li>
<li>
<a class=" dropdown-item" href="#1">View History</a>
</li>
<li aria-hidden="true" class="dropdown-divider" role="presentation"></li>
<li>
<a class=" dropdown-item" href="#1">Permissions</a>
</li>
<li aria-hidden="true" class="dropdown-divider" role="presentation"></li>
<li>
<a class=" dropdown-item" href="#1">Copy</a>
</li>
<li>
<a class=" dropdown-item" href="#1">Move</a>
</li>
<li aria-hidden="true" class="dropdown-divider" role="presentation"></li>
<li>
<a class=" dropdown-item" href="#1">Move to the Recycle Bin</a>
</li>
</ul>
</div>
`;
exports[`ClayActionsDropdown should render an expanded action dropdown 1`] = `
<div class="dropdown dropdown-action show">
<button aria-expanded="true" aria-haspopup="true" aria-label="toggle" class="dropdown-toggle btn btn-unstyled" type="button">
Expand Down
44 changes: 30 additions & 14 deletions packages/clay-isomorphic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import java.io.File;

task testSoy << {
def soyFiles = fileTree(
dir: "..",
include: "clay-*/**/*.soy",
dir: "..",
include: "clay-*/**/*.soy",
excludes: ["**/__tests__/**/*", "clay-isomorphic/**/*"]
).files;

def suite = new SoyTestSuite(soyFiles);

def results = suite.run();

def failed = 0;

results.forEach {result ->
Expand All @@ -19,38 +19,54 @@ task testSoy << {
}
else {
failed++;

if (result.error) {
println "💥 " + result.namespace +
println "💥 " + result.namespace +
" [" + result.error.message + "]";
}
else {
println "👎 " + result.namespace +
println "👎 " + result.namespace +
" [Unexpected output: ${result.output}]";
}
}
};

if (failed > 0) {
throw new GradleException(
"${failed} soy tests failed 😢 (see previous output for more info)");
}
}

task regenerateFixturesExpected << {
def soyFiles = fileTree(
dir: "..",
include: "clay-*/**/*.soy",
excludes: ["**/__tests__/**/*", "clay-isomorphic/**/*"]
).files;

def suite = new SoyTestSuite(soyFiles);

def results = suite.run();

results.forEach {result ->
result.test.regenerateFixturesExpected();
};
}

task createMissingFixtures << {
def soyFiles = fileTree(
dir: "..",
include: "clay-*/**/*.soy",
dir: "..",
include: "clay-*/**/*.soy",
excludes: ["**/__tests__/**/*", "clay-isomorphic/**/*"]
).files;

def suite = new SoyTestSuite(soyFiles);

def results = suite.run();

results.forEach {result ->
if (result.error) {
result.test.createFixtureFilesIfMissing();
}
};
}
}
Loading