From efc2acdf2c19628c9e4032cc3ed858d926e1c075 Mon Sep 17 00:00:00 2001 From: Mario Celi Date: Wed, 9 Mar 2022 17:42:03 -0500 Subject: [PATCH] Add for every markdown task list item Necessary for the frontend to use in the work item convert to task button --- lib/banzai/filter/task_list_filter.rb | 3 ++ .../markdown_golden_master_examples.yml | 36 +++++++++---------- .../banzai/filter/task_list_filter_spec.rb | 13 +++++++ 3 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 spec/lib/banzai/filter/task_list_filter_spec.rb diff --git a/lib/banzai/filter/task_list_filter.rb b/lib/banzai/filter/task_list_filter.rb index c6b402575cb0dc..896f67cb8759c4 100644 --- a/lib/banzai/filter/task_list_filter.rb +++ b/lib/banzai/filter/task_list_filter.rb @@ -9,6 +9,9 @@ module Banzai module Filter class TaskListFilter < TaskList::Filter + def render_item_checkbox(item) + "#{super}" + end end end end diff --git a/spec/fixtures/markdown/markdown_golden_master_examples.yml b/spec/fixtures/markdown/markdown_golden_master_examples.yml index 630528e03731e9..8556811974dc5e 100644 --- a/spec/fixtures/markdown/markdown_golden_master_examples.yml +++ b/spec/fixtures/markdown/markdown_golden_master_examples.yml @@ -218,13 +218,13 @@ @@ -670,19 +670,19 @@ html: |-
  1. - hello
  2. + hello
  3. - world
  4. + world
  5. - example + example
    1. - of nested + of nested
      1. - task list
      2. + task list
      3. - items
      4. + items
    @@ -697,11 +697,11 @@ html: |-
    1. - hello
    2. + hello
    3. - world
    4. + world
    5. - example
    6. + example
    - name: reference_for_project_wiki @@ -810,19 +810,19 @@ html: |-
    • - hello
    • + hello
    • - world
    • + world
    • - example + example
      • - of nested + of nested
        • - task list
        • + task list
        • - items
        • + items
      diff --git a/spec/lib/banzai/filter/task_list_filter_spec.rb b/spec/lib/banzai/filter/task_list_filter_spec.rb new file mode 100644 index 00000000000000..c89acd1a643d8e --- /dev/null +++ b/spec/lib/banzai/filter/task_list_filter_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Banzai::Filter::TaskListFilter do + include FilterSpecHelper + + it 'adds `` to every list item' do + doc = filter("
        \n
      • [ ] testing item 1
      • \n
      • [x] testing item 2
      • \n
      ") + + expect(doc.xpath('.//li//task-button').count).to eq(2) + end +end -- GitLab