diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0a98ebe2..c8510372 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -74,6 +74,13 @@ jobs: if: steps.playwright-cache.outputs.cache-hit == 'true' run: npx playwright install-deps chromium + # The fixture pages load the plugin from dist/, which is only rebuilt at + # release time and is therefore usually behind src/ on a pull request. + # Build it here so the acceptance tests exercise the current source + # instead of the last released bundle. + - name: Build dist + run: npm run build + - name: Generate versioned test fixtures run: npm run test:fixtures diff --git a/documentation/_data/nav.js b/documentation/_data/nav.js index 8d7db221..e9b7ce68 100644 --- a/documentation/_data/nav.js +++ b/documentation/_data/nav.js @@ -49,6 +49,7 @@ module.exports = [ { id: 'input', text: 'Input Commands', url: '/demo/input.html' }, { id: 'keeping-contextmenu-open', text: 'Keeping the context menu open', url: '/demo/keeping-contextmenu-open.html' }, { id: 'menu-title', text: 'Menus with titles', url: '/demo/menu-title.html' }, + { id: 'menu-title-fontawesome', text: 'Menu title with Font Awesome icons', url: '/demo/menu-title-fontawesome.html' }, { id: 'menu-promise', text: 'Menu with promise', url: '/demo/menu-promise.html' }, { id: 'on-dom-element', text: 'Context Menu on DOM Element', url: '/demo/on-dom-element.html' }, { id: 'sub-menus', text: 'Submenus', url: '/demo/sub-menus.html' }, diff --git a/documentation/demo.md b/documentation/demo.md index f4ad7e27..5daecc67 100644 --- a/documentation/demo.md +++ b/documentation/demo.md @@ -73,6 +73,7 @@ title: jQuery contextMenu — Demo gallery * [Input Commands](demo/input.html) * [Custom Command Types](demo/custom-command.html) * [Menus with titles](demo/menu-title.html) +* [Menu title with Font Awesome icons](demo/menu-title-fontawesome.html) * [Importing HTML5 ](demo/html5-import.html) * [HTML5 Polyfill](demo/html5-polyfill.html) * [HTML5 Polyfill (Firefox)](demo/html5-polyfill-firefox8.html) diff --git a/documentation/demo/menu-title-fontawesome.md b/documentation/demo/menu-title-fontawesome.md new file mode 100644 index 00000000..dbb59cc2 --- /dev/null +++ b/documentation/demo/menu-title-fontawesome.md @@ -0,0 +1,95 @@ +--- +currentMenu: menu-title-fontawesome +--- + +# Demo: Menu Title with Font Awesome icons + + + + + + +- [Example CSS](#example-css) +- [Example code](#example-code) +- [Example HTML](#example-html) + + + + + +Combining a [menu title](menu-title.html) with [Font Awesome icons](fontawesome-icons.html). +The icons stay vertically centered in their item, whether the menu has a title or not. + +right click me (with title) +right click me (no title) + +## Example CSS + +Note the child combinator in `> :first-child`: the top margin is only meant for +the first menu item, so that the title has room. Without it the rule also +matches the `` element that the plugin creates for a Font Awesome icon, +and the label of an input item, since those are the first child of their own +menu item. + + + +## Example code + + + +## Example HTML + +```html +right click me (with title) + +right click me (no title) +``` diff --git a/documentation/demo/menu-title.md b/documentation/demo/menu-title.md index ca9f95fd..0e5eae23 100644 --- a/documentation/demo/menu-title.md +++ b/documentation/demo/menu-title.md @@ -32,6 +32,12 @@ currentMenu: menu-title ## Example CSS +The title is rendered with a `:before` pseudo element on the menu itself, and +the first menu item is given a top margin so the title has room. Keep the child +combinator in `> :first-child`: a plain descendant selector would also match the +first child *inside* a menu item, such as the `` element created for a Font +Awesome icon or the `