deckar01-task_list-2.3.1/0000755000004100000410000000000013600440257015133 5ustar www-datawww-datadeckar01-task_list-2.3.1/.travis.yml0000644000004100000410000000062213600440257017244 0ustar www-datawww-datalanguage: ruby sudo: false addons: chrome: stable install: - rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION - ./script/bootstrap script: ./script/cibuild rvm: - 2.0 - 2.1 - 2.2 env: - TRAVIS_NODE_VERSION="11" notifications: email: false deckar01-task_list-2.3.1/test/0000755000004100000410000000000013600440257016112 5ustar www-datawww-datadeckar01-task_list-2.3.1/test/task_list_test.rb0000644000004100000410000000134513600440257021476 0ustar www-datawww-data# encoding: utf-8 require File.expand_path('../test_helper', __FILE__) require 'task_list' require 'task_list/filter' class TaskListTest < Minitest::Test class Record < Struct.new(:body) def task_list_items [] end end def test_has_summary assert summary = task_list("- [ ] one").summary, "summary expected" assert_kind_of TaskList::Summary, summary end def test_complete_item item = TaskList::Item.new("[x]", "complete") assert item.complete?, "expected to be complete" end def test_incomplete_item item = TaskList::Item.new("[ ]", "incomplete") assert !item.complete?, "expected to be incomplete" end protected def task_list(text) TaskList.new(Record.new(text)) end end deckar01-task_list-2.3.1/test/task_list/0000755000004100000410000000000013600440257020107 5ustar www-datawww-datadeckar01-task_list-2.3.1/test/task_list/summary_test.rb0000644000004100000410000000164113600440257023172 0ustar www-datawww-data# encoding: utf-8 require File.expand_path('../../test_helper', __FILE__) require 'task_list/summary' class TaskList::SummaryTest < Minitest::Test def setup @complete = make_item "[x]", "complete" @incomplete = make_item "[ ]", "incomplete" @items = [@complete, @incomplete] @summary = make_summary @items end def test_no_items summary = make_summary [] assert !summary.items?, "no task list items are expected" end def test_items assert @summary.items?, "task list items are expected" assert_equal 2, @summary.item_count end def test_complete_count assert_equal 1, @summary.complete_count end def test_incomplete_count assert_equal 1, @summary.incomplete_count end protected def make_item(checkbox_text = "[ ]", source = "an item!") TaskList::Item.new(checkbox_text, source) end def make_summary(items) TaskList::Summary.new(items) end end deckar01-task_list-2.3.1/test/task_list/filter_test.rb0000644000004100000410000000665713600440257022776 0ustar www-datawww-data# encoding: utf-8 require File.expand_path('../../test_helper', __FILE__) require 'task_list/filter' class TaskList::FilterTest < Minitest::Test def setup @pipeline = HTML::Pipeline.new [ HTML::Pipeline::MarkdownFilter, TaskList::Filter ], {}, {} @context = {} @item_selector = "input.task-list-item-checkbox[type=checkbox]" end def test_has_no_effect_on_lists_with_no_tasks text = <<-md - plain - bullets md assert_equal 0, filter(text)[:output].css('ul.task-list').size end def test_filters_items_in_a_list text = <<-md - [ ] incomplete - [x] complete md assert_equal 2, filter(text)[:output].css(@item_selector).size end def test_filters_items_with_HTML_contents text = <<-md - [ ] incomplete **with bold** text - [x] complete __with italic__ text md assert_equal 2, filter(text)[:output].css(@item_selector).size end def test_filters_items_in_a_list_wrapped_in_paras # See issue #7951 for details. text = <<-md - [ ] one - [ ] this one will be wrapped in a para - [ ] this one too, wtf md assert_equal 3, filter(text)[:output].css(@item_selector).size end def test_populates_result_with_task_list_items text = <<-md - [ ] incomplete - [x] complete md result = filter(text) assert !result[:task_list_items].empty? incomplete, complete = result[:task_list_items] assert incomplete assert !incomplete.complete? assert complete assert complete.complete? end def test_skips_lists_in_code_blocks code = <<-md ``` - [ ] incomplete - [x] complete ``` md assert filter(code)[:output].css(@item_selector).empty?, "should not have any task list items" end def test_handles_encoding_correctly unicode = "中文" text = <<-md - [ ] #{unicode} md assert item = filter(text)[:output].css('.task-list-item').pop assert_equal unicode, item.text.strip end def test_handles_nested_items text = <<-md - [ ] one - [ ] one.one md assert item = filter(text)[:output].css('.task-list-item .task-list-item').pop end def test_handles_complicated_nested_items text = <<-md - [ ] one - [ ] one.one - [x] one.two - [ ] one.two.one - [ ] one.two.two - [ ] one.three - [ ] one.four - [ ] two - [x] two.one - [ ] two.two - [ ] three md assert_equal 6 + 2, filter(text)[:output].css('.task-list-item .task-list-item').size assert_equal 2, filter(text)[:output].css('.task-list-item .task-list-item .task-list-item').size end # NOTE: This is an edge case experienced regularly by users using a Swiss # German keyboard. # See: https://github.com/github/github/pull/18362 def test_non_breaking_space_between_brackets text = "- [\xC2\xA0] ok" assert item = filter(text)[:output].css('.task-list-item').pop, "item expected" assert_equal 'ok', item.text.strip end # See: https://github.com/github/github/pull/18362 def test_non_breaking_space_between_brackets_in_paras text = <<-md - [\xC2\xA0] one - [\xC2\xA0] this one will be wrapped in a para - [\xC2\xA0] this one too, wtf md assert_equal 3, filter(text)[:output].css(@item_selector).size end def test_capital_X text = <<-md - [x] lower case - [X] capital md assert_equal 2, filter(text)[:output].css("[checked]").size end protected def filter(input, context = @context, result = nil) result ||= {} @pipeline.call(input, context, result) end end deckar01-task_list-2.3.1/test/unit/0000755000004100000410000000000013600440257017071 5ustar www-datawww-datadeckar01-task_list-2.3.1/test/unit/test_events.coffee0000644000004100000410000000443313600440257022611 0ustar www-datawww-datawindow.$ = window.jQuery = require('jquery') window.TaskList = require('../../app/assets/javascripts/task_list') QUnit.module "TaskList events", beforeEach: -> @container = $ '
', class: 'js-task-list-container' @list = $ '

Using CommonMark Source Positioning

deckar01-task_list-2.3.1/test/test_helper.rb0000644000004100000410000000010013600440257020744 0ustar www-datawww-data$:.unshift "lib" require 'minitest/autorun' require 'task_list' deckar01-task_list-2.3.1/config.ru0000644000004100000410000000112213600440257016744 0ustar www-datawww-data# Rack environment for testing purposes require 'coffee-script' require 'json' require 'sprockets' Root = File.expand_path("..", __FILE__) Assets = Sprockets::Environment.new(Root) do |env| env.append_path "bower_components" env.append_path "app/assets/javascripts" env.append_path "app/assets/stylesheets" env.append_path "test" end map "/assets" do run Assets end map "/update" do run lambda { |env| sleep 0.5 req = Rack::Request.new(env) [200, {'Content-Type' => 'application/json'}, [req.params.to_json]] } end map "/" do run Rack::Directory.new(Root) end deckar01-task_list-2.3.1/README.md0000644000004100000410000001320413600440257016412 0ustar www-datawww-data# Task Lists [![Build Status](http://img.shields.io/travis/deckar01/task_list.svg)][travis] [travis]: https://travis-ci.org/deckar01/task_list This is a community fork of GitHub's archived [`task_list`][task_list] gem. [task_list]: https://github.com/github-archive/task_list ```md - [x] Get - [x] More - [ ] Done ``` > - [x] Get > - [x] More > - [ ] Done ## Components The Task List feature is made of several different components: * Markdown Ruby Filter * Summary Ruby Model: summarizes task list items * JavaScript: frontend task list update behavior * CSS: styles Markdown task list items ## Usage & Integration The backend components are designed for rendering the Task List item checkboxes, and the frontend components handle updating the Markdown source (embedded in the markup). ### Backend: Markdown pipeline filter Rendering Task List item checkboxes from source Markdown depends on the `TaskList::Filter`, designed to integrate with the [`html-pipeline`](https://github.com/jch/html-pipeline) gem. For example: ``` ruby require 'html/pipeline' require 'task_list/filter' pipeline = HTML::Pipeline.new [ HTML::Pipeline::MarkdownFilter, TaskList::Filter ] pipeline.call "- [ ] task list item" ``` ### Frontend: Markdown Updates Task List updates on the frontend require specific HTML markup structure, and must be enabled with JavaScript. Rendered HTML (the `