==== External libraries ====
* Update es5-shim from v4.0.0 to v4.1.5.
* Update json2 from revision 2014-02-04 to 2015-05-03.
-* Update Sinon.JS from 1.10.3 to 1.15.0.
+* Update Sinon.JS from 1.10.3 to 1.15.4.
* Upgrade jQuery Client from v1.0.0 to v2.0.0.
-* Added mediawiki/at-ease 1.0.0
+* Added mediawiki/at-ease 1.0.0.
+* Update QUnit from v1.17.1 to v1.18.0.
=== Bug fixes in 1.26 ===
* (T53283) load.php sometimes sends 304 response without full headers
"leafo/lessphp": "0.5.0",
"liuggio/statsd-php-client": "1.0.12",
"mediawiki/at-ease": "1.0.0",
- "oojs/oojs-ui": "0.11.7",
+ "oojs/oojs-ui": "0.11.8",
"php": ">=5.3.3",
"psr/log": "1.0.0",
"wikimedia/cdb": "1.0.1",
"wikimedia/assert": "0.2.2",
- "wikimedia/composer-merge-plugin": "1.2.0",
+ "wikimedia/composer-merge-plugin": "1.2.1",
"wikimedia/utfnormal": "1.0.2",
"zordius/lightncandy": "0.21"
},
} else {
$this->executeActionWithErrorHandling();
}
- $this->getContext()->getStats()->increment(
- 'api.modules.' . strtr( $this->getModule()->getModulePath(), '+', '.' ) );
}
/**
$this->checkAsserts( $params );
// Execute
+ $this->getContext()->getStats()->increment(
+ 'api.modules.' . strtr( $module->getModulePath(), '+', '.' ) );
$module->execute();
Hooks::run( 'APIAfterExecute', array( &$module ) );
'prop' => array(
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_DFLT => 'ids|title|flags',
+ ApiBase::PARAM_HELP_MSG_PER_VALUE => array(),
ApiBase::PARAM_TYPE => array(
'ids',
'title',
"apihelp-parse-param-effectivelanglinks": "Includes language links supplied by extensions (for use with <kbd>$1prop=langlinks</kbd>).",
"apihelp-parse-param-section": "Only retrieve the content of this section number or when <kbd>new</kbd> generate a new section.\n\n<kbd>new</kbd> section is only honored when specifying <var>text</var>.",
"apihelp-parse-param-sectiontitle": "New section title when <var>section</var> is <kbd>new</kbd>.\n\nUnlike page editing, this does not fall back to <var>summary</var> when omitted or empty.",
- "apihelp-parse-param-disablepp": "Disable the PP Report from the parser output.",
- "apihelp-parse-param-disableeditsection": "Disable edit section links from the parser output.",
+ "apihelp-parse-param-disablepp": "Omit the preprocessor report (\"NewPP limit report\") from the parser output.",
+ "apihelp-parse-param-disableeditsection": "Omit edit section links from the parser output.",
"apihelp-parse-param-generatexml": "Generate XML parse tree (requires content model <code>$1</code>; replaced by <kbd>$2prop=parsetree</kbd>).",
"apihelp-parse-param-preview": "Parse in preview mode.",
"apihelp-parse-param-sectionpreview": "Parse in section preview mode (enables preview mode too).",
- "apihelp-parse-param-disabletoc": "Disable table of contents in output.",
+ "apihelp-parse-param-disabletoc": "Omit table of contents in output.",
"apihelp-parse-param-contentformat": "Content serialization format used for the input text. Only valid when used with $1text.",
"apihelp-parse-param-contentmodel": "Content model of the input text. If omitted, $1title must be specified, and default will be the model of the specified title. Only valid when used with $1text.",
"apihelp-parse-example-page": "Parse a page.",
"apihelp-query+watchlist-param-user": "Only list changes by this user.",
"apihelp-query+watchlist-param-excludeuser": "Don't list changes by this user.",
"apihelp-query+watchlist-param-limit": "How many total results to return per request.",
- "apihelp-query+watchlist-param-prop": "Which additional items to get:\n;ids:Adds revision IDs and page IDs.\n;title:Adds title of the page.\n;flags:Adds flags for the edit.\n;user:Adds the user who made the edit.\n;userid:Adds user ID of whom made the edit.\n;comment:Adds comment of the edit.\n;parsedcomment:Adds parsed comment of the edit.\n;timestamp:Adds timestamp of the edit.\n;patrol:Tags edits that are patrolled.\n;sizes:Adds the old and new lengths of the page.\n;notificationtimestamp:Adds timestamp of when the user was last notified about the edit.\n;loginfo:Adds log information where appropriate.",
+ "apihelp-query+watchlist-param-prop": "Which additional properties to get:",
+ "apihelp-query+watchlist-paramvalue-prop-ids": "Adds revision IDs and page IDs.",
+ "apihelp-query+watchlist-paramvalue-prop-title": "Adds title of the page.",
+ "apihelp-query+watchlist-paramvalue-prop-flags": "Adds flags for the edit.",
+ "apihelp-query+watchlist-paramvalue-prop-user": "Adds the user who made the edit.",
+ "apihelp-query+watchlist-paramvalue-prop-userid": "Adds user ID of whoever made the edit.",
+ "apihelp-query+watchlist-paramvalue-prop-comment": "Adds comment of the edit.",
+ "apihelp-query+watchlist-paramvalue-prop-parsedcomment": "Adds parsed comment of the edit.",
+ "apihelp-query+watchlist-paramvalue-prop-timestamp": "Adds timestamp of the edit.",
+ "apihelp-query+watchlist-paramvalue-prop-patrol": "Tags edits that are patrolled.",
+ "apihelp-query+watchlist-paramvalue-prop-sizes": "Adds the old and new lengths of the page.",
+ "apihelp-query+watchlist-paramvalue-prop-notificationtimestamp": "Adds timestamp of when the user was last notified about the edit.",
+ "apihelp-query+watchlist-paramvalue-prop-loginfo": "Adds log information where appropriate.",
+
"apihelp-query+watchlist-param-show": "Show only items that meet these criteria. For example, to see only minor edits done by logged-in users, set $1show=minor|!anon.",
"apihelp-query+watchlist-param-type": "Which types of changes to show:\n;edit:Regular page edits.\n;external:External changes.\n;new:Page creations.\n;log:Log entries.",
"apihelp-query+watchlist-param-owner": "Used along with $1token to access a different user's watchlist.",
"apihelp-checktoken-param-type": "調べるトークンの種類。",
"apihelp-checktoken-param-token": "調べるトークン。",
"apihelp-checktoken-example-simple": "<kbd>csrf</kbd> トークンの妥当性を調べる。",
+ "apihelp-compare-description": "2つの版間の差分を取得します。\n\n\"from\" と \"to\" の両方の版番号、ページ名、もしくはページIDを渡す必要があります。",
+ "apihelp-compare-param-fromtitle": "比較する1つ目のページ名。",
+ "apihelp-compare-param-fromid": "比較する1つ目のページID。",
+ "apihelp-compare-param-fromrev": "比較する1つ目の版。",
+ "apihelp-compare-param-totitle": "比較する2つ目のページ名。",
+ "apihelp-compare-param-toid": "比較する2つ目のページID。",
+ "apihelp-compare-param-torev": "比較する2つ目の版。",
"apihelp-compare-example-1": "版1と2の差分を生成する。",
"apihelp-createaccount-description": "新しい利用者アカウントを作成します。",
"apihelp-createaccount-param-name": "利用者名。",
"apihelp-createaccount-param-password": "パスワード (<var>$1mailpassword</var> が設定されると無視されます)。",
+ "apihelp-createaccount-param-domain": "外部認証のドメイン (省略可能)。",
"apihelp-createaccount-param-token": "最初のリクエストで得られたアカウント作成用トークンです。",
"apihelp-createaccount-param-email": "利用者の電子メールアドレス (任意)。",
"apihelp-createaccount-param-realname": "利用者の本名 (省略可能)。",
"apihelp-delete-param-reason": "削除の理由です。入力しない場合、自動的に生成された理由が使用されます。",
"apihelp-delete-param-watch": "そのページを現在の利用者のウォッチリストに追加します。",
"apihelp-delete-param-unwatch": "そのページを現在の利用者のウォッチリストから除去します。",
+ "apihelp-delete-param-oldimage": "削除する古い画像の[[Special:ApiHelp/query+imageinfo|action=query&prop=imageinfo&iiprop=archivename]] で取得できるような名前。",
"apihelp-delete-example-simple": "<kbd>Main Page</kbd> を削除する",
"apihelp-delete-example-reason": "<kbd>Preparing for move</kbd> という理由で <kbd>Main Page</kbd> を削除する",
"apihelp-disabled-description": "このモジュールは無効化されています。",
"apihelp-edit-param-watch": "そのページを現在の利用者のウォッチリストに追加します。",
"apihelp-edit-param-unwatch": "そのページを現在の利用者のウォッチリストから除去します。",
"apihelp-edit-param-prependtext": "このテキストをページの先頭に追加します。$1text をオーバーライドします。",
+ "apihelp-edit-param-appendtext": "このテキストをページの末尾に追加する。$1textを上書きします。\n\n新しい節を追加するにはこのパラメータではなく $1section=newを使用してください。",
"apihelp-edit-param-undo": "この版を取り消します。$1text, $1prependtext および $1appendtext をオーバーライドします。",
"apihelp-edit-param-undoafter": "$1undo からこの版までのすべての版を取り消します。設定しない場合、ひとつの版のみ取り消されます。",
"apihelp-edit-param-token": "このトークンは常に最後のパラメーターとして、または少なくとも $1text パラメーターより後に送信されるべきです。",
"apihelp-expandtemplates-description": "ウィキテキストに含まれるすべてのテンプレートを展開します。",
"apihelp-expandtemplates-param-title": "ページの名前です。",
"apihelp-expandtemplates-param-text": "変換するウィキテキストです。",
- "apihelp-expandtemplates-paramvalue-prop-wikitext": "拡大ウィキテキスト。",
+ "apihelp-expandtemplates-paramvalue-prop-wikitext": "展開されたウィキテキスト。",
"apihelp-expandtemplates-param-includecomments": "HTMLコメントを出力に含めるかどうか。",
"apihelp-expandtemplates-example-simple": "ウィキテキスト <kbd><nowiki>{{Project:Sandbox}}</nowiki></kbd> を展開する。",
"apihelp-feedcontributions-description": "利用者の投稿記録フィードを返します。",
"apihelp-import-example-import": "[[meta:Help:ParserFunctions]] をすべての履歴とともに名前空間100に取り込む。",
"apihelp-login-param-name": "利用者名。",
"apihelp-login-param-password": "パスワード。",
- "apihelp-login-param-domain": "ドメイン(オプション)",
+ "apihelp-login-param-domain": "ドメイン (省略可能)",
"apihelp-login-param-token": "最初のリクエストで取得したログイントークンです。",
"apihelp-login-example-gettoken": "ログイントークンを取得する。",
"apihelp-login-example-login": "ログイン",
"apihelp-edit-param-minor": "En klein Änderong.",
"apihelp-edit-param-notminor": "Kein klein Änderong.",
"apihelp-edit-param-bot": "Makeer heh di Änderog als vun enem Bot jemaat.",
+ "apihelp-edit-param-basetimestamp": "Dattom un Zigg för de Ußjangs_Väsjohn, di jenumme weed, öm dubbel Beärbeijdonge bemärke ze künne. Di kam_mer övver di Sigg <code lang=\"en\" xml:lang=\"en\" dir=\"ltr\"[[Special:ApiHelp/query+revisions|action=query&prop=revisions&rvprop=timestamp]]</code> eruß fenge.",
+ "apihelp-edit-param-starttimestamp": "Dattom un Zigg för wann et Beärbeijde loßß jing, di jenumme weed, öm dubbel Beärbeijdonge bemärke ze künne. Di kam_mer övver di Sigg <code lang=\"en\" xml:lang=\"en\" dir=\"ltr\"[[Special:ApiHelp/main|curtimestamp]]</code> eruß fenge em Momang, woh mem Beärbeijde bejenne deihjt.",
"apihelp-edit-param-recreate": "Övverjangk alle Fähler övver di Sigg, di en der Zweschezigg fott jeschneße wohd.",
"apihelp-edit-param-createonly": "Donn di Sigg nit ändere, wann se ald doh es.",
"apihelp-edit-param-nocreate": "Mäld ene Fähler, wann di Sigg nit doh es.",
"apihelp-expandtemplates-param-revid": "De Kännong vun dä Väsjohn, för \n„<code lang=\"en\" xml:lang=\"en\" dir=\"ltr\"><nowiki>{{REVISIONID}}</nowiki></code>“ un verwandte Wääte.",
"apihelp-expandtemplates-paramvalue-prop-categories": "Alle Saachjroppe en dä Quällesigg, di em Wikkitäx vun de ußjejovve Sigg nit vorkumme.",
"apihelp-expandtemplates-paramvalue-prop-properties": "De Sigge_Eijeschaffte, di vun de Zauberwööter em Wikkitäx faßjelaat wähde.",
+ "apihelp-expandtemplates-paramvalue-prop-ttl": "De längste Zigg noh dä de zweschejescheijscherte jevonge Dahte nmmieh jöltesch sin sulle.",
"apihelp-expandtemplates-paramvalue-prop-modules": "Alle Moduhle vum <i lang=\"en\" xml:lang=\"en\" dir=\"ltr\" title=\"Delivery system in MediaWiki for the optimized run-time loading and managing of modules\">ResourceLoader</i>, di noh de Paaserfonksjuhne en de Ußjahbe vörkumme sulle. Äntwehder „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">jsconfigvars</kbd>“ udder „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">encodedjsconfigvars</kbd>“ moß mer met „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">modules</kbd>“ zesamme aanforrdere.",
"apihelp-expandtemplates-paramvalue-prop-jsconfigvars": "Jitt de Varrejahble fun de Einschtällonge vun heh Sigg, di nur för di Sigg johd sin.",
"apihelp-expandtemplates-paramvalue-prop-encodedjsconfigvars": "Jitt de Varrejahble fun de Einschtällonge vun heh Sigg, di nur för di Sigg johd sin, em <i lang=\"en\" xml:lang=\"en\" dir=\"ltr\" title=\"JavaScript Object Notation\">JSON</i>-Fommahd als en Reih vun Zeijsche.",
"apihelp-import-param-fullhistory": "För et Empottehre us enem andere Wikki: Donn de jannze Verjangeheid empottehre, nit blohß de aktoälle Väsjohn.",
"apihelp-import-param-templates": "För et Empottehre us enem andere Wikki: Donn all de nühdejje Schablohne met empottehre.",
"apihelp-import-param-namespace": "En heh dat Appachtemang emmpotehre. Kam_mer nit mem Parramehter „<var lang=\"en\" xml:lang=\"en\" dir=\"ltr\">$1rootpage</var>“ zersamme bruche.",
- "apihelp-import-param-rootpage": "Als Ongersigg vun heh dä Sigg empottehre. Weed ävver övverjange, wann dä der Parramehter „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">$1namespace</kbd>“ derbei aanjejovve es.",
+ "apihelp-import-param-rootpage": "Als Ongersigg vun heh dä Sigg empottehre. Km_mer nit zosamme met däm Parramehter „<varlang=\"en\" xml:lang=\"en\" dir=\"ltr\">$1namespace</var>“ bruche.",
"apihelp-import-example-import": "Donn di Sigg „<code lang=\"en\" xml:lang=\"en\" dir=\"ltr\">[[meta:Help:ParserFunctions]]</code>“ en et Appachtemang <code>100</code>empottehre, met alle älldere Väsjohne ennjeschloßße.",
"apihelp-login-param-name": "Metmaacher_Nahme.",
"apihelp-login-param-password": "Paßwoot.",
"apihelp-opensearch-param-suggest": "Don nix wann „<var lang=\"en\" xml:lang=\"en\" dir=\"ltr\">[[mw:Manual:$wgEnableOpenSearchSuggest|$wgEnableOpenSearchSuggest]]</var>“ op „<code lang=\"en\" xml:lang=\"en\" dir=\"ltr\">false</code>“ jesaz es.",
"apihelp-opensearch-param-redirects": "Wi met Ömleidonge ömjonn?\n;return:Jivv de Ömleidonge sällver uß.\n;resolve:Jiff de Sigg uß, woh de Ömleidong hen jeiht. Dat künnt winnijer wi „<code lang=\"en\" xml:lang=\"en\" dir=\"ltr\">$1limit</code>“ Sigge ußjävve.\nTradizonäll es dä Schtandatt „<code lang=\"en\" xml:lang=\"en\" dir=\"ltr\">return</code>“ för „<code lang=\"en\" xml:lang=\"en\" dir=\"ltr\">$1format=json</code>“ un „<code lang=\"en\" xml:lang=\"en\" dir=\"ltr\">resolve</code>“ för alle anndere.",
"apihelp-opensearch-param-format": "Et Fommaht zom Ußjävve.",
+ "apihelp-opensearch-param-warningsaserror": "Wann Warnonge opkumme met „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">format=json</kbd>“, dann donn ene Fähler vum <i lang=\"en\" xml:lang=\"en\" dir=\"ltr\" title=\"Application Programming Interface\">API</i> ußjävve anschtat se ze övverjonn.",
"apihelp-opensearch-example-te": "Fengk Sigge, di met <kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">Te</kbd> aanfange.",
"apihelp-options-param-reset": "Säz de Enschtällonge op dem Wikki singe Standatt.",
"apihelp-options-param-optionname": "Dä Nahme vun ene Enschtällong, di op dä Wäät jesaz wähde sulle, dä „<var lang=\"en\" xml:lang=\"en\" dir=\"ltr\">$1optionvalue</var>“ aanjitt.",
"apihelp-options-param-optionvalue": "Ene Wäät vun dä Enschtällong, di vun „<var lang=\"en\" xml:lang=\"en\" dir=\"ltr\">$1optionname</var>“ aanjejovve weed. Kann Sänkrääschte Schresche („|“) äänthallde.",
"apihelp-options-example-reset": "Alle enschtälloonge retuur schtälle.",
+ "apihelp-options-example-change": "Donn de „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">skin</kbd>“ un „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">hideminor</kbd>“ Enschtällonge ändere.",
"apihelp-options-example-complex": "Donn alle Enschtällonge op der Schtandatt säze, dann säz „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">skin</kbd>“ un „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">nickname</kbd>“.",
"apihelp-paraminfo-description": "Holl Aanjahbe övver dä <i lang=\"en\" xml:lang=\"en\" dir=\"ltr\" title=\"Application Programming Interface\">API</i> ier Moduhle.",
"apihelp-paraminfo-param-helpformat": "Et Fommaht vun de Täxe för Hölp.",
"apihelp-paraminfo-param-formatmodules": "Leß met de Nahme vun de Moduhle zom Fommatehre (Wäät vum „<var lang=\"en\" xml:lang=\"en\" dir=\"ltr\">format</var>“-Parramehter). Nemm schtatt dämm „<varlang=\"en\" xml:lang=\"en\" dir=\"ltr\">$1modules</var>“.",
"apihelp-paraminfo-example-1": "Zisch Aanjahbe övver <kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">[[Special:ApiHelp/parse|action=parse]]</kbd>, <kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">[[Special:ApiHelp/jsonfm|format=jsonfm]]</kbd>, <kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">[[Special:ApiHelp/query+allpages|action=query&list=allpages]]</kbd>, un <kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">[[Special:ApiHelp/query+siteinfo|action=query&meta=siteinfo]]</kbd>.",
"apihelp-parse-param-summary": "De Zersammefaßong för ze pahse.",
+ "apihelp-parse-param-redirects": "Wann „<var lang=\"en\" xml:lang=\"en\" dir=\"ltr\">$1page</var>“ udder „<var lang=\"en\" xml:lang=\"en\" dir=\"ltr\">$1pageid</var>“ obb_en Ömleijdong jesaz es, donn dä follje.",
"apihelp-parse-param-prop": "Wat för en Schtöker aan Ennfommazjuhne holle:",
"apihelp-parse-paramvalue-prop-text": "Jitt dä jepahßde Täx vum Wikkitäx uß.",
"apihelp-parse-paramvalue-prop-langlinks": "Jitt de Schprohche-Lengks em jepahßde Wikkitäx uß.",
"apihelp-parse-paramvalue-prop-properties": "Jitt devärse Eijeschafte uß, di em jepahßde Wikkitäx faßjelaat woode sen.",
"apihelp-parse-param-section": "Holl blohß dann der Ennhalld vun däm Affschnett met dä Nommer, udder wann „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">new</kbd>“ enjejovve es, maach ene neu Affschnett derbei.",
"apihelp-parse-param-sectiontitle": "De Övverschreff för dä neuje Afschnet, wann <var lang=\"en\" xml:lang=\"en\" dir=\"ltr\">section</var> = <kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">new</kbd> es.\n\nAnders wi beim Beärbeide vun dä Sigg weed dä Parramehter nit dorsch de <var lang=\"en\" xml:lang=\"en\" dir=\"ltr\">summary</var> ußjetuusch, wann hä fottjelohße udder läddesch es.",
+ "apihelp-parse-param-disableeditsection": "Donn e lenks för Affschnedde ze änndere en de Ußjahbe vum Paaser affschallde.",
"apihelp-parse-param-disabletoc": "Donn et Ennhaldsverzeijscheneß en de Ußjahbe vottlohze.",
"apihelp-parse-example-page": "Donn en Sigg pahse.",
"apihelp-parse-example-text": "Donn Wikkitäx pahse.",
"apihelp-protect-param-reason": "Der Jrond för et Schöze udder Freijävve.",
"apihelp-protect-example-protect": "Donn en Sigg schöze.",
"apihelp-purge-param-forcelinkupdate": "Bräng de Tabälle met de lengks obb ene neue Schtand.",
+ "apihelp-purge-example-simple": "Donn fö de Sigge „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">Main Page</kbd>“ un „<kbd lang=\"en\" xml:lang=\"en\" dir=\"ltr\">API</kbd>“ de zweschejeschpeijscherte Väsjohn fottschmiiße.",
+ "apihelp-purge-example-generator": "Donn fö de eezte zehn Sigge em Schtanndadd_Appachtemang de zweschejeschpeijscherte Väsjohn fottschmiiße.",
"apihelp-query-param-prop": "Wat för en Eijeschaffte holle för de affjerohchte Sigge.",
"apihelp-query-param-list": "Wat för en Leßte holle.",
"apihelp-query-param-meta": "Wat för en Metta_Dahte ze holle.",
"apihelp-query+recentchanges-example-simple": "Lista ostatnich zmian.",
"apihelp-query+redirects-param-limit": "Ile przekierowań zwrócić.",
"apihelp-query+revisions+base-paramvalue-prop-ids": "Identyfikator wersji.",
+ "apihelp-query+revisions+base-paramvalue-prop-flags": "Znaczniki wersji (drobne).",
+ "apihelp-query+revisions+base-paramvalue-prop-timestamp": "Znacznik czasu wersji.",
+ "apihelp-query+revisions+base-paramvalue-prop-content": "Tekst wersji.",
+ "apihelp-query+revisions+base-paramvalue-prop-tags": "Znaczniki wersji.",
"apihelp-query+revisions+base-param-limit": "Ograniczenie na liczbę wersji, które będą zwrócone.",
"apihelp-query+search-description": "Wykonaj wyszukiwanie pełnotekstowe.",
"apihelp-query+search-param-info": "Które metadane zwrócić.",
"apihelp-query+watchlist-param-user": "{{doc-apihelp-param|query+watchlist|user}}",
"apihelp-query+watchlist-param-excludeuser": "{{doc-apihelp-param|query+watchlist|excludeuser}}",
"apihelp-query+watchlist-param-limit": "{{doc-apihelp-param|query+watchlist|limit}}",
- "apihelp-query+watchlist-param-prop": "{{doc-apihelp-param|query+watchlist|prop}}",
+ "apihelp-query+watchlist-param-prop": "{{doc-apihelp-param|query+watchlist|prop|paramvalues=1}}",
+ "apihelp-query+watchlist-paramvalue-prop-ids": "{{doc-apihelp-paramvalue|query+watchlist|prop|ids}}",
+ "apihelp-query+watchlist-paramvalue-prop-title": "{{doc-apihelp-paramvalue|query+watchlist|prop|title}}",
+ "apihelp-query+watchlist-paramvalue-prop-flags": "{{doc-apihelp-paramvalue|query+watchlist|prop|flags}}",
+ "apihelp-query+watchlist-paramvalue-prop-user": "{{doc-apihelp-paramvalue|query+watchlist|prop|user}}",
+ "apihelp-query+watchlist-paramvalue-prop-userid": "{{doc-apihelp-paramvalue|query+watchlist|prop|userid}}",
+ "apihelp-query+watchlist-paramvalue-prop-comment": "{{doc-apihelp-paramvalue|query+watchlist|prop|comment}}",
+ "apihelp-query+watchlist-paramvalue-prop-parsedcomment": "{{doc-apihelp-paramvalue|query+watchlist|prop|parsedcomment}}",
+ "apihelp-query+watchlist-paramvalue-prop-timestamp": "{{doc-apihelp-paramvalue|query+watchlist|prop|timestamp}}",
+ "apihelp-query+watchlist-paramvalue-prop-patrol": "{{doc-apihelp-paramvalue|query+watchlist|prop|patrol}}",
+ "apihelp-query+watchlist-paramvalue-prop-sizes": "{{doc-apihelp-paramvalue|query+watchlist|prop|sizes}}",
+ "apihelp-query+watchlist-paramvalue-prop-notificationtimestamp": "{{doc-apihelp-paramvalue|query+watchlist|prop|notificationtimestamp}}",
+ "apihelp-query+watchlist-paramvalue-prop-loginfo": "{{doc-apihelp-paramvalue|query+watchlist|prop|loginfo}}",
"apihelp-query+watchlist-param-show": "{{doc-apihelp-param|query+watchlist|show}}",
"apihelp-query+watchlist-param-type": "{{doc-apihelp-param|query+watchlist|type}}",
"apihelp-query+watchlist-param-owner": "{{doc-apihelp-param|query+watchlist|owner}}",
"apihelp-edit-param-appendtext": "将该文本添加到该页面的结尾。覆盖$1text。\n\n采用$1section=new来添加一个新的章节,而不是这个参数。",
"apihelp-edit-param-undo": "撤销此次修订。覆盖$1text、$1prependtext和$1appendtext。",
"apihelp-edit-param-undoafter": "撤销从$1undo至此的所有修订。如果不设置就撤销一次修订。",
- "apihelp-edit-param-redirect": "自动解析重定向。",
+ "apihelp-edit-param-redirect": "自动解决重定向。",
"apihelp-edit-param-contentformat": "用于输入文本的内容串行化格式。",
"apihelp-edit-param-contentmodel": "新内容的内容模型。",
"apihelp-edit-param-token": "令牌应总是发送为最后参数,或至少在$1text参数之后。",
- "apihelp-edit-example-edit": "编辑一个页面",
- "apihelp-edit-example-prepend": "页面中预置<kbd>__NOTOC__</kbd>",
- "apihelp-edit-example-undo": "通过13585撤销修订版本13579并自动填写编辑摘要",
+ "apihelp-edit-example-edit": "编辑一个页面。",
+ "apihelp-edit-example-prepend": "页面中预置<kbd>__NOTOC__</kbd>。",
+ "apihelp-edit-example-undo": "通过13585撤销修订版本13579并自动填写编辑摘要。",
"apihelp-emailuser-description": "电子邮件联系一位用户。",
"apihelp-emailuser-param-target": "电子邮件的目标用户。",
"apihelp-emailuser-param-subject": "主题页眉。",
"apihelp-parse-paramvalue-prop-iwlinks": "在被解析的wiki文本中提供跨wiki链接。",
"apihelp-parse-paramvalue-prop-wikitext": "提供被解析的原始wiki文本。",
"apihelp-parse-paramvalue-prop-limitreportdata": "以结构化的方式提供限制报告。如果<var>$1disablepp</var>被设定则不提供数据。",
- "apihelp-parse-paramvalue-prop-parsetree": "修订å\86\85容ç\9a\84XML解æ\9e\90æ\95°ï¼\88é\9c\80è¦\81å\86\85容模å\9e\8b<code>$1</code>ï¼\89ã\80\82",
+ "apihelp-parse-paramvalue-prop-parsetree": "修订å\86\85容ç\9a\84XML解æ\9e\90æ \91ï¼\88é\9c\80è¦\81å\86\85容模å\9e\8b<code>$1</code>ï¼\89",
"apihelp-parse-param-pst": "在解析输入前,对输入做一次保存前变换处理。仅当使用文本时有效。",
"apihelp-parse-param-effectivelanglinks": "包含由扩展提供的语言链接(用于与<kbd>$1prop=langlinks</kbd>一起使用)。",
"apihelp-parse-param-section": "只检索此段数的内容,或只当<kbd>new</kbd>生成新的段落时检索。\n\n<kbd>new</kbd>段落只当指定<var>text</var>时受尊重。",
"apihelp-parse-param-preview": "在预览模式下解析。",
"apihelp-parse-param-sectionpreview": "在小节预览模式下解析 (同时要启用预览模式)。",
"apihelp-parse-param-disabletoc": "在输出中禁用目录。",
+ "apihelp-parse-param-contentformat": "用于输入文本的内容序列化格式。只当与$1text一起使用时有效。",
"apihelp-parse-example-page": "解析一个页面。",
"apihelp-parse-example-text": "解析wiki文本。",
- "apihelp-parse-example-texttitle": "解析维基文本,指定页面标题。",
+ "apihelp-parse-example-texttitle": "解析wiki文本,指定页面标题。",
"apihelp-parse-example-summary": "解析一个摘要。",
"apihelp-patrol-description": "巡查页面或修订版本。",
"apihelp-patrol-param-rcid": "所要巡查的最近变更 ID。",
"apihelp-query+alldeletedrevisions-param-excludeuser": "不要列出此用户做出的修订。",
"apihelp-query+alldeletedrevisions-param-namespace": "只列出此名字空间的页面。",
"apihelp-query+alldeletedrevisions-param-miser-user-namespace": "<strong>注意:</strong>由于[[mw:Manual:$wgMiserMode|miser模式]],同时使用<var>$1user</var>和<var>$1namespace</var>将导致继续前返回少于<var>$1limit</var>个结果,在极端条件下可能不返回任何结果。",
+ "apihelp-query+alldeletedrevisions-param-generatetitles": "当作为生成器使用时,生成标题而不是修订ID。",
"apihelp-query+alldeletedrevisions-example-user": "列出由<kbd>Example<kbd>作出的最近50次已删除贡献。",
"apihelp-query+alldeletedrevisions-example-ns-main": "列出前50次已删除的主名字空间修订。",
"apihelp-query+allfileusages-description": "列出所有文件用途,包括不存在的。",
"apihelp-query+allfileusages-param-from": "文件的标题开始枚举于.",
"apihelp-query+allfileusages-param-to": "要列举的最终文件标题。",
"apihelp-query+allfileusages-param-prefix": "搜索此值开头的所有文件标题。",
+ "apihelp-query+allfileusages-param-unique": "只显示明显的文件标题。不能与$1prop=ids一起使用。\n当作为生成器使用时,产生目标页面而不是来源页面。",
"apihelp-query+allfileusages-param-prop": "要包含的信息束:\n;ids:添加使用中的页面的页面ID(不能与$1unique一起使用)。\n;title:添加文件的标题。",
"apihelp-query+allfileusages-param-limit": "要返回的总计项目。",
"apihelp-query+allfileusages-param-dir": "罗列所采用的方向。",
"apihelp-query+deletedrevisions-param-excludeuser": "不要列出此用户做出的修订。",
"apihelp-query+deletedrevisions-example-titles": "列出页面<kbd>Main Page</kbd>和<kbd>Talk:Main Page</kbd>的已删除修订,包含内容。",
"apihelp-query+deletedrevisions-example-revids": "列出已删除修订<kbd>123456</kbd>的信息。",
+ "apihelp-query+deletedrevs-description": "列出被删除修订。\n\n操作于三种模式中:\n# List deleted revisions for the given titles, sorted by timestamp.\n# List deleted contributions for the given user, sorted by timestamp (no titles specified).\n# List all deleted revisions in the given namespace, sorted by title and timestamp (no titles specified, $1user not set).\n\nCertain parameters only apply to some modes and are ignored in others.",
"apihelp-query+deletedrevs-paraminfo-modes": "{{PLURAL:$1|模式}}:$2",
"apihelp-query+deletedrevs-param-from": "从此标题开始列出。",
"apihelp-query+deletedrevs-param-to": "列出至此标题为止。",
"apihelp-query+deletedrevs-param-user": "只列出此用户做出的修订。",
"apihelp-query+deletedrevs-param-excludeuser": "不要列出此用户做出的修订。",
"apihelp-query+deletedrevs-param-namespace": "只列出此名字空间的页面。",
+ "apihelp-query+deletedrevs-param-prop": "要获取的属性:\n;revid:添加被删除修订的修订ID。\n;parentid:添加上一修订的修订ID至页面。\n;user:添加做出修订的用户。\n;userid:添加做出修订的用户ID。\n;comment:添加修订摘要。\n;parsedcomment:添加解析过的修订摘要。\n;minor:如果修订是小编辑则加标签。\n;len:添加修订长度(字节)。\n;sha1:添加修订的SHA-1(base 16)。\n;content:添加修订内容。\n;token:<span class=\"apihelp-deprecated\">已弃用。</span>提供编辑令牌。\n;tags:修订标签。",
"apihelp-query+deletedrevs-example-mode1": "列出最近已删除的对页面<kbd>Main Page</kbd>和<kbd>Talk:Main Page</kbd>的贡献,带内容(模式1)。",
"apihelp-query+deletedrevs-example-mode2": "列出由<kbd>Bob</kbd>作出的最近50次已删除贡献(模式2)。",
"apihelp-query+deletedrevs-example-mode3-main": "列出前50次主名字空间已删除贡献(模式3)",
"apihelp-query+imageinfo-paramvalue-prop-parsedcomment": "解析版本上的注释。",
"apihelp-query+imageinfo-paramvalue-prop-canonicaltitle": "添加文件的规范标题。",
"apihelp-query+imageinfo-paramvalue-prop-url": "为文件及其描述页面提供URL。",
- "apihelp-query+imageinfo-paramvalue-prop-dimensions": "大小别名。",
+ "apihelp-query+imageinfo-paramvalue-prop-size": "添加文件大小(字节)及其高度、宽度和页面数(如果可以)。",
+ "apihelp-query+imageinfo-paramvalue-prop-dimensions": "用于大小的别名。",
"apihelp-query+imageinfo-paramvalue-prop-sha1": "为文件加入SHA-1哈希值。",
"apihelp-query+imageinfo-paramvalue-prop-mime": "添加文件的MIME类型。",
+ "apihelp-query+imageinfo-paramvalue-prop-thumbmime": "添加图片缩略图的MIME类型(需要url和参数$1urlwidth)。",
"apihelp-query+imageinfo-paramvalue-prop-mediatype": "添加文件媒体类型。",
"apihelp-query+imageinfo-paramvalue-prop-metadata": "列出这个版本的文件的EXIF元数据。",
+ "apihelp-query+imageinfo-paramvalue-prop-commonmetadata": "为文件的修订版本列出文件格式相关元数据。",
+ "apihelp-query+imageinfo-paramvalue-prop-extmetadata": "列出结合自多个来源的格式化的元数据。结果均依HTML格式化。",
+ "apihelp-query+imageinfo-paramvalue-prop-archivename": "添加用于非最新修订的存档修订的文件名。",
+ "apihelp-query+imageinfo-paramvalue-prop-bitdepth": "添加修订的字节深度。",
+ "apihelp-query+imageinfo-paramvalue-prop-uploadwarning": "由Special:Upload所使用,以获取关于现有文件的信息。不适用于MediaWiki核心以外代码。",
"apihelp-query+imageinfo-param-limit": "每个文件返回多少文件修订。",
"apihelp-query+imageinfo-param-start": "开始列举的时间戳。",
"apihelp-query+imageinfo-param-end": "列举的结束时间戳。",
"apihelp-query+revisions-example-first5-after": "获取<kbd>Main Page</kbd>于2006年05月01日之后做出的前5次修订版本。",
"apihelp-query+revisions-example-first5-not-localhost": "获取<kbd>Main Page</kbd>的前5次不是由匿名用户<kbd>127.0.0.1</kbd>做出的修订。",
"apihelp-query+revisions-example-first5-user": "获取<kbd>Main Page</kbd>的前5次由用户<kbd>MediaWiki default</kbd>做出的修订。",
+ "apihelp-query+revisions+base-param-prop": "要为每个修订获取的属性:",
"apihelp-query+revisions+base-paramvalue-prop-ids": "修订ID。",
"apihelp-query+revisions+base-paramvalue-prop-flags": "修订标记(小编辑)。",
+ "apihelp-query+revisions+base-paramvalue-prop-timestamp": "修订的时间戳。",
+ "apihelp-query+revisions+base-paramvalue-prop-user": "做出修订的用户。",
+ "apihelp-query+revisions+base-paramvalue-prop-userid": "修订创建者的用户ID。",
+ "apihelp-query+revisions+base-paramvalue-prop-sha1": "修订的SHA-1(base 16)。",
+ "apihelp-query+revisions+base-paramvalue-prop-contentmodel": "修订的内容模型ID。",
+ "apihelp-query+revisions+base-paramvalue-prop-content": "修订文本。",
+ "apihelp-query+revisions+base-paramvalue-prop-tags": "修订标签。",
+ "apihelp-query+revisions+base-paramvalue-prop-parsetree": "修订内容的XML解析树(需要内容模型<code>$1</code>)。",
"apihelp-query+revisions+base-param-limit": "限制返回多少修订。",
+ "apihelp-query+revisions+base-param-expandtemplates": "展开修订内容中的模板(需要$1prop=content)。",
"apihelp-query+revisions+base-param-generatexml": "生成用于修订内容的XML解析树(需要$1prop=content;被<kbd>$1prop=parsetree</kbd>所取代)。",
+ "apihelp-query+revisions+base-param-parse": "解析修订内容(需要$1prop=content)。由于性能原因,如果此选项被使用,$1limit会被强制为1。",
+ "apihelp-query+revisions+base-param-section": "只检索此段落数的内容。",
+ "apihelp-query+revisions+base-param-diffto": "要比较修订差异的修订ID。使用<kbd>prev</kbd>、<kbd>next</kbd>和<kbd>cur</kbd>分别用于上个、下个和当前修订。",
+ "apihelp-query+revisions+base-param-difftotext": "要比较修订差异的文本。只有修订的有限数字内的差异。覆盖<var>$1diffto</var>。如果<var>$1section</var>被设置,只有那个段落将与此文本之间比较差异",
+ "apihelp-query+revisions+base-param-contentformat": "序列化用于<var>$1difftotext</var>的格式并预估内容输出。",
"apihelp-query+search-description": "执行一次全文本搜索。",
"apihelp-query+search-param-search": "搜索所有匹配此值的页面标题或内容。根据wiki的搜索后端工具,您可以使用搜索字符串以调用特殊搜索功能。",
"apihelp-query+search-param-namespace": "只在这些名字空间搜索。",
"api-pageset-param-pageids": "要工作的页面ID列表。",
"api-pageset-param-revids": "要工作的修订ID列表。",
"api-pageset-param-generator": "通过执行指定查询模块获得页面列表以工作。\n\n<strong>注意:</strong>发生器参数名称必须以“g”开头,参见例子。",
+ "api-pageset-param-redirects-generator": "自动解决在<var>$1titles</var>、<var>$1pageids</var>和<var>$1revids</var>,以及在由<var>$1generator</var>返回的页面中的重定向。",
"api-pageset-param-redirects-nogenerator": "自动解决<var>$1titles</var>、<var>$1pageids</var>和<var>$1revids</var>中的重定向。",
+ "api-pageset-param-converttitles": "如有需要,将标题转换为其他变体。只有当wiki的内容语言支持变体转换时才能工作。支持变体转换的语言包括$1。",
"api-help-title": "MediaWiki API 帮助",
"api-help-lead": "这是自动生成的MediaWiki API文档页面。\n\n文档和例子:https://www.mediawiki.org/wiki/API:Main_page/zh",
"api-help-main-header": "主模块",
if ( $options['cacheReport'] ) {
$result .= "\n/* cache key: $key */";
}
- $cache->set( $key, $result );
+ // Set a TTL since HHVM's APC doesn't have any limitation or eviction logic.
+ $cache->set( $key, $result, 24 * 3600 );
} catch ( Exception $e ) {
MWExceptionHandler::logException( $e );
$this->logger->warning( 'Minification failed: {exception}', array(
class TitleInputWidget extends TextInputWidget {
protected $namespace = null;
+ protected $relative = null;
/**
* @param array $config Configuration options
- * @param number|null $config['namespace'] Namespace to prepend to queries
+ * @param int|null $config['namespace'] Namespace to prepend to queries
+ * @param bool|null $config['relative'] If a namespace is set, return a title relative to it (default; true)
*/
public function __construct( array $config = array() ) {
// Parent constructor
parent::__construct( array_merge( $config, array( 'infusable' => true ) ) );
- // Properties
+ // Properties, which are ignored in PHP and just shipped back to JS
if ( isset( $config['namespace'] ) ) {
- // Actually ignored in PHP, we just ship it back to JS
$this->namespace = $config['namespace'];
}
+ if ( isset( $config['relative'] ) ) {
+ $this->relative = $config['relative'];
+ }
+
// Initialization
$this->addClasses( array( 'mw-widget-TitleInputWidget' ) );
}
if ( $this->namespace !== null ) {
$config['namespace'] = $this->namespace;
}
+ if ( $this->relative !== null ) {
+ $config['relative'] = $this->relative;
+ }
return parent::getConfig( $config );
}
}
"newarticle": "(নতুন)",
"newarticletext": "আপুনি বিচৰা প্ৰবন্ধটো বিচাৰি পোৱা নগ'ল।\n\nইচ্ছা কৰিলে আপুনিয়েই এই প্ৰবন্ধটো লিখা আৰম্ভ কৰিব পাৰে। [$1 ইয়াত] সহায় পাব।\n\nআপুনি যদি ইয়ালৈ ভুলতে আহিছে, তেনেহলে আপোনাৰ ব্ৰাওজাৰৰ '''BACK''' বুটামত টিপা মাৰক।",
"anontalkpagetext": "----''এইখন আলোচনা পৃষ্ঠা বেনামী সদস্যৰ বাবে, যিয়ে নিজা একাউণ্ট সৃষ্টি কৰা নাই বা যিয়ে সেই একাউণ্ট ব্যৱহাৰ নকৰে।\nএতেকে আমি তেখেতসকলক আই-পি ঠিকনাৰে চিনাক্ত কৰিবলৈ বাধ্য।\nসেই একেই আই-পি ঠিকনা অনেকেই ব্যৱহাৰ কৰিব পাৰে।\nআপুনি যদি এজন বেনামী সদস্য আৰু যদি আপুনি অনুভৱ কৰে যে আপোনাৰ প্ৰতি অপ্ৰাসঙ্গিক মন্তব্য কৰা হৈছে, তেনেহলে আন বেনামী সদস্যৰ পৰা পৃথক কৰিবলৈ \n[[Special:UserLogin/signup|একাউন্ট সৃষ্টি কৰক]] বা [[Special:UserLogin|প্ৰৱেশ কৰক]] ।''",
- "noarticletext": "à¦\8fà¦\87 পà§\83ষà§\8dঠাত বৰà§\8dতমান à¦\95à§\8bনà§\8b পাঠà§\8dয নাà¦\87 ।\nà¦\86পà§\81নি à¦\86ন পà§\83ষà§\8dঠাত [[Special:Search/{{PAGENAME}}| à¦\8fà¦\87 শিৰà§\8bনামা à¦\85নà§\81সনà§\8dধান à¦\95ৰিব পাৰà§\87]],\n<span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} সমà§\8dপৰà§\8dà¦\95à§\80য় à¦\85à¦à¦¿à¦²à§\87à¦\96 à¦\85নà§\81সন্ধান কৰিব পাৰে],\nবা [{{fullurl:{{FULLPAGENAME}}|action=edit}} এই পৃষ্ঠা সম্পাদনা কৰিব পাৰে]</span>",
- "noarticletext-nopermission": "à¦\8fà¦\87 পà§\83ষà§\8dঠাত বৰà§\8dতমান à¦\95à§\8bনà§\8b পাঠà§\8dয নাà¦\87।\nà¦\86পà§\81নি à¦\86ন পà§\83ষà§\8dঠাত [[Special:Search/{{PAGENAME}}|à¦\8fà¦\87 শিৰà§\8bনামা à¦\85নà§\81সনà§\8dধান à¦\95ৰিব পাৰà§\87]],\nবা <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} সমà§\8dপৰà§\8dà¦\95à§\80য় à¦\85à¦à¦¿à¦²à§\87à¦\96 à¦\85নà§\81সন্ধান কৰিব পাৰে]</span>, কিন্তু এই পৃষ্ঠা সৃষ্টি কৰিবলৈ আপোনাৰ অনুমতি নাই।",
+ "noarticletext": "à¦\8fà¦\87 পà§\83ষà§\8dঠাত বৰà§\8dতমান à¦\95à§\8bনà§\8b পাঠà§\8dয নাà¦\87 ।\nà¦\86পà§\81নি à¦\86ন পà§\83ষà§\8dঠাত [[Special:Search/{{PAGENAME}}| à¦\8fà¦\87 শিৰà§\8bনামা সনà§\8dধান à¦\95ৰিব পাৰà§\87]],\n<span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} সমà§\8dপৰà§\8dà¦\95à§\80য় à¦\85à¦à¦¿à¦²à§\87à¦\96 সন্ধান কৰিব পাৰে],\nবা [{{fullurl:{{FULLPAGENAME}}|action=edit}} এই পৃষ্ঠা সম্পাদনা কৰিব পাৰে]</span>",
+ "noarticletext-nopermission": "à¦\8fà¦\87 পà§\83ষà§\8dঠাত বৰà§\8dতমান à¦\95à§\8bনà§\8b পাঠà§\8dয নাà¦\87।\nà¦\86পà§\81নি à¦\86ন পà§\83ষà§\8dঠাত [[Special:Search/{{PAGENAME}}|à¦\8fà¦\87 শিৰà§\8bনামা সনà§\8dধান à¦\95ৰিব পাৰà§\87]],\nবা <span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} সমà§\8dপৰà§\8dà¦\95à§\80য় à¦\85à¦à¦¿à¦²à§\87à¦\96 সন্ধান কৰিব পাৰে]</span>, কিন্তু এই পৃষ্ঠা সৃষ্টি কৰিবলৈ আপোনাৰ অনুমতি নাই।",
"missing-revision": "\"{{FULLPAGENAME}}\" নামৰ পৃষ্ঠাৰ #$1 সংশোধনৰ অস্তিত্ব নাই।\n\nসাধাৰণতে বিলোপ কৰা এখন পৃষ্ঠাৰ পুৰণা ইতিহাস লিংক অনুসৰণ কৰিলে এনে হয়।\n[{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} বিলোপন ল'গ]ত অধিক তথ্য পাব।",
"userpage-userdoesnotexist": "\"<nowiki>$1</nowiki>\" নামৰ সদস্য একাউন্ট নিবন্ধিত নহয় ।\nঅনুগ্ৰহ কৰি চাওক আপুনি এই পৃষ্ঠা সৃষ্টি/সম্পাদনা কৰিব বিচাৰিছে নেকি ।",
"userpage-userdoesnotexist-view": "সদস্য একাউন্ট ''$1'' পঞ্জীভূত নহয়",
"searchprofile-advanced": "উচ্চতৰ",
"searchprofile-articles-tooltip": "$1-ত অনুসন্ধান কৰক",
"searchprofile-images-tooltip": "ফাইলৰ বাবে অনুসন্ধান",
- "searchprofile-everything-tooltip": "সà¦\95লà§\8b বিষয়বসà§\8dতà§\81 à¦\85নà§\81সনà§\8dধান à¦\95ৰà¦\95 (à¦\95থা-বতৰা পৃষ্ঠা সহ)",
+ "searchprofile-everything-tooltip": "সà¦\95লà§\8b বিষয়বসà§\8dতà§\81 সনà§\8dধান à¦\95ৰà¦\95 (à¦\86লà§\8bà¦\9aনা পৃষ্ঠা সহ)",
"searchprofile-advanced-tooltip": "স্বনিৰ্ধাৰিত নামস্থানত অনুসন্ধান কৰক",
"search-result-size": "$1 ({{PLURAL:$2|1 শব্দ|$2 শব্দসমূহ}})",
"search-result-category-size": "{{PLURAL:$1|১ জন সদস্য|$1 জন সদস্য}} ({{PLURAL:$2|এটা উপশ্ৰেণী|$2 টা উপশ্ৰেণী}}, {{PLURAL:$3|এটা ফাইল|$3 টা ফাইল}})",
"powersearch-togglenone": "একো নাই",
"powersearch-remember": "ভৱিষ্যতৰ সন্ধানৰ বাবে বাছনি মনত ৰাখক।",
"search-external": "বাহ্যিক সন্ধান",
- "searchdisabled": "{{SITENAME}} ত à¦\85নà§\81সনà§\8dধান à¦\95ৰা সাময়িà¦\95 à¦à¦¾à¦¬à§\87 নিষà§\8dà¦\95à§\8dৰিয় à¦\95ৰা হà§\88à¦\9bà§\87।\nতà§\87তিয়ালà§\88à¦\95à§\87 à¦\97à§\81à¦\97লত à¦\85নà§\81সন্ধান কৰক।\nমনত ৰাখিব যে তেঁওলোকৰ {{SITENAME}}ৰ ইণ্ডেক্স পুৰণি হব পাৰে।",
+ "searchdisabled": "{{SITENAME}} ত সনà§\8dধান à¦\95ৰা সাময়িà¦\95 à¦à¦¾à¦¬à§\87 নিষà§\8dà¦\95à§\8dৰিয় à¦\95ৰা হà§\88à¦\9bà§\87।\nতà§\87তিয়ালà§\88à¦\95à§\87 à¦\97à§\81à¦\97লত সন্ধান কৰক।\nমনত ৰাখিব যে তেঁওলোকৰ {{SITENAME}}ৰ ইণ্ডেক্স পুৰণি হব পাৰে।",
"search-error": "অনুসন্ধানৰ সময়ত এটা ত্ৰুটি হৈছে: $1",
"preferences": "পছন্দসমূহ",
"mypreferences": "পছন্দসমূহ",
"prefs-editing": "সম্পাদন",
"rows": "পথালী শাৰী:",
"columns": "ঠিয় শাৰী:",
- "searchresultshead": "à¦\85নà§\81সনà§\8dধান",
+ "searchresultshead": "সনà§\8dধান à¦\95ৰà¦\95",
"stub-threshold": "<a href=\"#\" class=\"stub\">আধাৰ সংযোগ</a> ৰ সৰ্বোচ্চ আকাৰ (বাইটত):",
"stub-threshold-disabled": "নিষ্ক্ৰিয়",
"recentchangesdays": "শেহতীয়া সাল-সলনিত দেখুৱাব লগা দিন:",
"upload_directory_read_only": "আপল’ড ডিৰেক্টৰি ($1) ৱেবচাৰ্ভাৰৰ দ্বাৰা লিখনযোগ্য নহয় ।",
"uploaderror": "আপল’ডত সমস্যা হৈছে",
"upload-recreate-warning": "'''সতৰ্কবাণী: এই নামৰ এটা ফাইল বিলোপ বা স্থানান্তৰ কৰা হৈছে । '''\n\nএই পৃষ্ঠাৰ অৱলুপ্তি ল’গ আৰু স্থানান্তৰ ল’গ আপোনাৰ সুবিধাৰ্থে তলত দিয়া হ’ল:",
- "uploadtext": "ফাà¦\87ল à¦\86পলâ\80\99ড à¦\95ৰাৰ বাবà§\87 তলৰ পà§\8dৰপতà§\8dৰ বà§\8dযৱহাৰ à¦\95ৰà¦\95। পà§\82ৰà§\8dবà§\87 à¦\86পলâ\80\99ড à¦\95ৰা ফাà¦\87ল à¦\9aাবলà§\88 বা à¦\85নà§\81সনà§\8dধান à¦\95ৰিবলà§\88 [[Special:FileList|à¦\86পলâ\80\99ড à¦\95ৰা ফাà¦\87লৰ তালিà¦\95া]] লà§\88 যাà¦\93à¦\95 । (পà§\81নà¦\83) à¦\86পলâ\80\99ড à¦\95ৰা ফাà¦\87লৰ নাম [[Special:Log/upload|à¦\86পলâ\80\99ড à¦\85à¦à¦¿à¦²à§\87à¦\96ত]] à¦à§°à§\8dতি হয়, বিলà§\8bপ à¦\95ৰা ফাà¦\87লৰ নাম [[Special:Log/delete|à¦\85ৱলà§\81পà§\8dতি à¦\85à¦à¦¿à¦²à§\87à¦\96ত]] পাব ।\n\nà¦\95à§\8bনà§\8b পà§\83ষà§\8dঠাত à¦\9aিতà§\8dৰ বা ফাà¦\87ল সনà§\8dনিবিষà§\8dà¦\9f à¦\95ৰিবৰ বাবà§\87 তলৰ পà§\8dৰপতà§\8dৰসমà§\82হত থà¦\95া সà¦\82যà§\8bà¦\97 বà§\8dযৱহাৰ à¦\95ৰà¦\95: \n* '''<code><nowiki>[[</nowiki>{{ns:file}}<nowiki>:File.jpg]]</nowiki></code>''',\n* '''<code><nowiki>[[</nowiki>{{ns:file}}<nowiki>:File.png|200px|thumb|left|alt text]]</nowiki></code>''' à¦\85থবা\n* '''<code><nowiki>[[</nowiki>{{ns:media}}<nowiki>:File.ogg]]</nowiki></code>'''",
+ "uploadtext": "ফাইল আপল’ড কৰাৰ বাবে তলৰ প্ৰপত্ৰ ব্যৱহাৰ কৰক। পূৰ্বে আপল’ড কৰা ফাইল চাবলৈ বা সন্ধান কৰিবলৈ [[Special:FileList|আপল’ড কৰা ফাইলৰ তালিকা]] লৈ যাওক । (পুনঃ) আপল’ড কৰা ফাইলৰ নাম [[Special:Log/upload|আপল’ড অভিলেখত]] ভৰ্তি হয়, বিলোপ কৰা ফাইলৰ নাম [[Special:Log/delete|অৱলুপ্তি অভিলেখত]] পাব ।\n\nকোনো পৃষ্ঠাত চিত্ৰ বা ফাইল সন্নিবিষ্ট কৰিবৰ বাবে তলৰ প্ৰপত্ৰসমূহত থকা সংযোগ ব্যৱহাৰ কৰক: \n* '''<code><nowiki>[[</nowiki>{{ns:file}}<nowiki>:File.jpg]]</nowiki></code>''',\n* '''<code><nowiki>[[</nowiki>{{ns:file}}<nowiki>:File.png|200px|thumb|left|alt text]]</nowiki></code>''' অথবা\n* '''<code><nowiki>[[</nowiki>{{ns:media}}<nowiki>:File.ogg]]</nowiki></code>'''",
"upload-permitted": "অনুমোদিত ফাইল ধৰণ: $1",
"upload-preferred": "বাঞ্ছিত ফাইল ধৰণ: $1",
"upload-prohibited": "বঞ্চিত ফাইল ধৰণ: $1",
"upload_source_file": "(আপোনাৰ কম্পিউটাৰৰ এটা ফাইল)",
"listfiles-delete": "বিলোপ কৰক",
"listfiles-summary": "এই বিশেষ পৃষ্ঠাত সকলো আপল’ড হোৱা ফাইল দেখা পাব।",
- "listfiles_search_for": "মিডিয়াৰ নাম à¦\85নà§\81সনà§\8dধান:",
+ "listfiles_search_for": "মিডিয়াৰ নাম সন্ধান:",
"imgfile": "ফাইল",
"listfiles": "ফাইলৰ তালিকা",
"listfiles_thumb": "ক্ষুদ্ৰ প্ৰতিকৃতি",
"filedelete-edit-reasonlist": "বিলোপৰ কাৰণ সম্পাদনা",
"filedelete-maintenance": "চোৱা-চিতাৰ সময়ত ফাইলৰ বিলুপ্তি আৰু পুনৰুদ্ধাৰ সাময়িকভাৱে নিষ্ক্ৰিয় কৰা হৈছে ।",
"filedelete-maintenance-title": "ফাইল বিলোপ কৰিব নোৱাৰি",
- "mimesearch": "MIME à¦\85নà§\81সনà§\8dধান",
+ "mimesearch": "MIME সন্ধান",
"mimesearch-summary": "এই পৃষ্ঠাৰ জৰিয়তে ফাইলসমূহক MIME প্ৰকাৰ অনুসৰি চেকিব পৰা যায় ।\nইনপুট: contenttype/subtype, যেনে- <code>image/jpeg</code> ।",
"mimetype": "MIME প্ৰকাৰ:",
"download": "ডাউনল’ড কৰক",
"suppress": "অমনোযোগ",
"querypage-disabled": "কাৰ্য্যগত কাৰণত এই বিশেষ পৃষ্ঠাটো নিষ্ক্ৰিয় কৰা হৈছে।",
"booksources": "গ্ৰন্থৰ উৎস সমূহ",
- "booksources-search-legend": "à¦\97à§\8dৰনà§\8dথ à¦\89à§\8eস à¦\85নà§\81সনà§\8dধান",
+ "booksources-search-legend": "গ্ৰন্থ উৎস সন্ধান",
"booksources-search": "সন্ধান",
"booksources-text": "নতুন আৰু পুৰণি কিতাপ বেচা চাইটসমূহৰ সংযোগ তলত দিয়া হৈছে, তাত আপুনি বিচৰা কিতাপসমূহৰ বিষয়ে অধিক তথ্যও পাব পাৰে:",
"booksources-invalid-isbn": "আপুনি দিয়া ISBN সম্ভৱতঃ অবৈধ; মূল উৎসৰ পৰা তুলি লওঁতে হ’ব পৰা ভুলৰ বাবে পৰীক্ষা কৰক ।",
"deletedcontributions": "ৰদ কৰা সদস্যৰ বৰঙণিসমূহ",
"deletedcontributions-title": "ৰদ কৰা সদস্যৰ বৰঙণিসমূহ",
"sp-deletedcontributions-contribs": "বৰঙণিসমূহ",
- "linksearch": "বাহà§\8dযিà¦\95 সà¦\82যà§\8bà¦\97 à¦\85নà§\81সনà§\8dধান",
- "linksearch-pat": "à¦\85নà§\81সনà§\8dধান à¦\86ৰà§\8dহি:",
+ "linksearch": "বাহ্যিক সংযোগ সন্ধান",
+ "linksearch-pat": "সন্ধান আৰ্হি:",
"linksearch-ns": "নামস্থান:",
- "linksearch-ok": "à¦\85নà§\81সনà§\8dধান",
+ "linksearch-ok": "সনà§\8dধান à¦\95ৰà¦\95",
"linksearch-text": "ৱাইল্ডকাৰ্ডসমূহ যেনে \"*.wikipedia.org\" ব্যৱহাৰ কৰিব পাৰি।\nঅন্তত এটা উচ্চ-স্তৰৰ ডমেইনৰ প্ৰয়োজন, উদাহৰণস্বৰূপ \"*.org\"। <br />\nসমৰ্থিত {{PLURAL:$2|প্ৰ'ট'ক'ল|প্ৰ'ট'ক'লসমূহ}} : <code>$1</code> (কোনো প্ৰ'ট'ক'ল নিৰ্দিষ্ট নকৰিলে http:// সূচাব)।",
"linksearch-line": "$2 পৰা $1 সংযোগ কৰা হৈছে",
"linksearch-error": "ৱাইল্ডকাৰ্ড কেৱল হ'ষ্টনামৰ আৰম্ভণিতহে দেখা যাব ।",
"sp-contributions-userrights": "সদস্যৰ অধিকাৰ ব্যৱস্থাপনা",
"sp-contributions-blocked-notice": "এই সদস্যজনক সদ্যহতে বাৰণ কৰা হৈছে ।\nআপোনাৰ সুবিধাৰ্থে শেহতীয়া প্ৰতিবন্ধক অভিলেখ ভৰ্তি তলত দিয়া হ’ল:",
"sp-contributions-blocked-notice-anon": "এই আই.পি. ঠিকনা সদ্যহতে বাৰণ কৰা হৈছে ।\nআপোনাৰ সুবিধাৰ্থে শেহতীয়া প্ৰতিবন্ধক অভিলেখ ভৰ্তি তলত দিয়া হ’ল:",
- "sp-contributions-search": "বৰà¦\99ণিসমà§\82হৰ à¦\95াৰণà§\87 à¦\85নà§\81সনà§\8dধান à¦\95ৰà¦\95",
+ "sp-contributions-search": "বৰঙণিসমূহৰ কাৰণে সন্ধান কৰক",
"sp-contributions-username": "আই.পি. ঠিকনা অথবা ব্যৱহাৰকৰ্তাৰ নাম:",
"sp-contributions-toponly": "কেৱল সাম্প্ৰতিক সংস্কৰণৰ অন্তৰ্গত সম্পাদনাসমূহ দেখুৱাওক",
"sp-contributions-submit": "সন্ধান কৰক",
"blocklist-by": "প্ৰশাসকক বাধাপ্ৰদান",
"blocklist-params": "অৱৰোধ পাৰামিটাৰসমূহ",
"blocklist-reason": "কাৰণ:",
- "ipblocklist-submit": "à¦\85নà§\81সনà§\8dধান",
+ "ipblocklist-submit": "সনà§\8dধান à¦\95ৰà¦\95",
"ipblocklist-localblock": "স্থানীয় বাৰণ",
"ipblocklist-otherblocks": "অন্যান্য {{PLURAL:$1|বাৰণ|বাৰণসমূহ}}",
"infiniteblock": "অসীম",
"dberr-again": "অলপ সময় অপেক্ষা কৰি পুনৰ আপল'ডৰ চেষ্টা কৰক ।",
"dberr-info": "(তথ্যকোষৰ চাৰ্ভাৰৰ লগত যোগাযোগ কৰিব নোৱাৰি: $1)",
"dberr-info-hidden": "(তথ্যকোষৰ চাৰ্ভাৰৰ লগত যোগাযোগ কৰিব নোৱাৰি)",
- "dberr-usegoogle": "à¦\8fà¦\87 পৰিসà§\8dথিতিত à¦\86পà§\81নি à¦\97à§\81à¦\97লৰ মাধà§\8dযমà§\87ৰà§\87 à¦\85নà§\81সনà§\8dধান à¦\95ৰিব পাৰà§\87 ।",
+ "dberr-usegoogle": "à¦\8fà¦\87 পৰিসà§\8dথিতিত à¦\86পà§\81নি à¦\97à§\81à¦\97লৰ মাধà§\8dযমà§\87ৰà§\87 সনà§\8dধান à¦\95ৰিব পাৰà§\87।",
"dberr-outofdate": "মন কৰক যে, আমাৰ বিষয়বস্তু সম্পৰ্কে তেওঁলোকৰ সূচী পুৰণা হ'ব পাৰে ।",
"dberr-cachederror": "এইখন অনুৰোধ কৰা পৃষ্ঠাৰ কেচ্ড লিপি, যিখন নবীকৰণ নকৰাও হ'ব পাৰে ।",
"htmlform-invalid-input": "আপোনাৰ কিছুমান অন্তৰ্ভুক্তিত সমস্যা হৈছে",
"htmlform-cloner-create": "আৰু যোগ কৰক",
"htmlform-cloner-delete": "আঁতৰাওক",
"sqlite-has-fts": "$1 সম্পূৰ্ণ-পাঠ অনুসন্ধান সমৰ্থন সহ",
- "sqlite-no-fts": "$1 সমà§\8dপà§\82ৰà§\8dণ-পাঠà¦\85নà§\81সনà§\8dধান সমৰà§\8dথন à¦\85বিহনà§\87",
+ "sqlite-no-fts": "$1 সম্পূৰ্ণ-পাঠ সন্ধান সমৰ্থন অবিহনে",
"logentry-delete-delete": "$3 পৃষ্ঠাটো $1ৰদ্বাৰা {{GENDER:$2|বিলোপ কৰা হ'ল}}",
"logentry-delete-restore": "$1-এ $3 পৃষ্ঠাটো {{GENDER:$2|পুনৰ্সংৰক্ষণ কৰিলে}}",
"logentry-delete-event": "$3: $4 -ত {{PLURAL:$5|এটা লগ ঘটনা|$5 লগ ঘটনাসমূহ}} -ৰ $1 পৰিৱৰ্তন কৰা দৃশ্যমানতা",
"sessionfailure": "Магчыма ўзьніклі праблемы ў Вашым цяперашнім сэансе працы;\nгэта дзеяньне было скасавана для прадухіленьня перахопу сэансу.\nКалі ласка, націсьніце «назад» і перазагрузіце старонку, зь якой Вы прыйшлі, і паспрабуйце ізноў.",
"changecontentmodel": "Зьмена мадэлі зьместу старонкі",
"changecontentmodel-legend": "Зьмена мадэлі зьместу",
+ "changecontentmodel-title-label": "Назва старонкі",
"protectlogpage": "Журнал абаронаў",
"protectlogtext": "Ніжэй пададзены сьпіс зьменаў абароны старонкі.\nГлядзіце [[Special:ProtectedPages|сьпіс абароненых старонак на цяперашні момант]].",
"protectedarticle": "абароненая «[[$1]]»",
"datedefault": "Nije bitno",
"prefs-labs": "Eksperimentalne mogućnosti",
"prefs-user-pages": "Korisničke stranice",
- "prefs-personal": "Korisnički podaci",
- "prefs-rc": "Podešavanja nedavnih izmjena",
- "prefs-watchlist": "Moji praćeni članci",
+ "prefs-personal": "Korisnički profil",
+ "prefs-rc": "Nedavne izmjene",
+ "prefs-watchlist": "Praćeni članci",
"prefs-editwatchlist": "Uredi spisak praćenja",
"prefs-editwatchlist-label": "Uredi unose na spisku praćenja:",
"prefs-editwatchlist-edit": "Pregledaj i ukloni članke sa spiska praćenja",
"prefs-rendering": "Izgled",
"saveprefs": "Sačuvaj",
"restoreprefs": "Vrati sve pretpostavljene postavke (u svim sekcijama)",
- "prefs-editing": "Veličine tekstualnog polja",
+ "prefs-editing": "Uređivanje",
"rows": "Redova",
"columns": "Kolona",
"searchresultshead": "Podešavanja rezultata pretrage",
"blocklog-showsuppresslog": "Ovaj korisnik je ranije blokiran i sakriven. Zapisnik sakrivanja je prikazan ispod kao referenca:",
"blocklogentry": "je blokirao [[$1]] sa vremenom isticanja blokade od $2 $3",
"reblock-logentry": "promjena postavki blokiranja za [[$1]] sa vremenom isteka u $2 $3",
- "blocklogtext": "Ovo je historija akcija blokiranja i deblokiranja korisnika.\nAutomatski blokirane IP adrese nisu navedene ovdje.\nPogledajte [[Special:BlockList|spisak blokiranja]] za spisak trenutnih zabrana i blokiranja.",
+ "blocklogtext": "Ispod je spisak blokiranja i deblokiranja korisnika.\nAutomatski blokirane IP adrese nisu ispisane ispod.\nPogledajte [[Special:BlockList|spisak blokiranja]] za spisak trenutnih zabrana i blokiranja.",
"unblocklogentry": "deblokiran $1",
"block-log-flags-anononly": "samo anonimni korisnici",
"block-log-flags-nocreate": "pravljenje računa onemogućeno",
"rcshowhidebots-hide": "پنهان کردن",
"rcshowhideliu": "$1 کاربران ثبتنامکردە",
"rcshowhideliu-show": "نمایش",
- "rcshowhideliu-hide": "Ù¾Ù\86Ù\87اÙ\86 کردن",
+ "rcshowhideliu-hide": "Ù\86Ù\87Ù\81تن",
"rcshowhideanons": "$1 کاربران ناشناس",
"rcshowhideanons-show": "نمایش",
"rcshowhideanons-hide": "پنهان کردن",
"passwordreset": "Paaswurd turagsaat",
"passwordreset-text-one": "Fal detheer formulaar ütj, am din paaswurd turag tu saaten.",
"passwordreset-text-many": "{{PLURAL:$1|Fal ian faan jodiat fialen ütj, am en tidjwiis paaswurd tuschüürd tu fun.}}",
- "passwordreset-legend": "Paaswurd turagsaat",
"passwordreset-disabled": "Dü könst din paaswurd uun detdiar wiki ei turagsaat.",
"passwordreset-emaildisabled": "E-mail as üüb detheer Wiki ufknipset wurden.",
"passwordreset-username": "Brükernööm:",
"resettokens": "Tokens turagsaat",
"resettokens-text": "Dü könst 'tokens' turagsaat, am priwoot dooten tu bewerkin, diar mä din brükerkonto ferbünjen san.",
"resettokens-no-tokens": "Diar san nian tokens turagtusaaten.",
- "resettokens-legend": "Tokens turagsaat",
"resettokens-tokens": "Tokens:",
"resettokens-token-label": "$1 (aktuel wäärs: $2)",
"resettokens-watchlist-token": "Token för webfeed (Atom/RSS) mä [[Special:Watchlist|feranrangen faan sidjen, diar dü uun't uug behual wel]]",
"nmembers": "{{PLURAL:$1|1 iindrach|$1 iindracher}}",
"nmemberschanged": "$1 → $2 {{PLURAL:$2|lasmoot|lasmooten}}",
"nrevisions": "$1 {{PLURAL:$1|feranrang|feranrangen}}",
- "nviews": "$1 {{PLURAL:$1|klik|kliks}}",
"nimagelinks": "Brükt üüb $1 {{PLURAL:$1|sidj|sidjen}}",
"ntransclusions": "brükt üüb $1 {{PLURAL:$1|sidj|sidjen}}",
"specialpage-empty": "Diar san tu tidj nian iindracher.",
"tooltip-pt-logout": "Ufmelde",
"tooltip-pt-createaccount": "Wees so gud an racht en brükerkonto iin an melde di uun. Dü säärst det oober ei.",
"tooltip-ca-talk": "Diskuschuun auer di artiikel",
- "tooltip-ca-edit": "Sidj bewerke. Luke di det iarst ans uun, iar dü det seekerst.",
+ "tooltip-ca-edit": "Detdiar sidj bewerke.",
"tooltip-ca-addsection": "Nei kirew began",
"tooltip-ca-viewsource": "Detdiar sidj as seekert wurden.\nDü könst di kweltekst uunluke.",
"tooltip-ca-history": "Ääler werjuunen faan detdiar sidj",
]
},
"tog-hideminor": "हालींच बदल केल्ल्यांतले बारीक संपादन लिपय",
- "tog-numberheadings": "शà¥\80रà¥\8dषà¤\95 स्वंय क्रमांकित कर",
+ "tog-numberheadings": "माथाळà¥\87 स्वंय क्रमांकित कर",
"tog-showtoolbar": "संपादन उपकरणाची पट्टी दाखय",
"tog-editondblclick": "दोट्टी क्लिकाचेर पानां संपादीत कर",
"tog-watchdefault": "हांवें संपादीत केल्लीं पानां आनी फायल म्हजे ध्यानसूचीक जोड",
"tog-oldsig": "सद्याची निशाणी",
"tog-uselivepreview": "लायव पुर्वनियाळाचो उपेग कर",
"tog-watchlisthideown": "ध्यानसुचीतलें म्हजे संपादन लिपय",
- "tog-watchlisthidebots": "ध्यानसुचीतले बोट संपादन लिपय",
+ "tog-watchlisthidebots": "धà¥\8dयानसà¥\81à¤\9aà¥\80तलà¥\87 रà¥\8bबà¥\8bà¤\9f सà¤\82पादन लिपय",
"tog-watchlisthideminor": "ध्यानसुचीतले ल्हान संपादन लिपय",
"tog-showhiddencats": "लिपोवन दवरिल्ले विभाग दाखय",
"underline-always": "सदा (केधन्नय) (केन्नय)",
"qbpageoptions": "हें पान",
"qbmyoptions": "म्हजी पानां",
"faq": "परत परत विचारिल्ले प्रस्न",
- "faqpage": "सदांच विचारील्ले प्रस्न",
+ "faqpage": "Project:सदांच विचारील्ले प्रस्न",
"actions": "क्रिया",
"namespaces": "नांवथलां",
"variants": "वेगवेगळें",
"blocklogpage": "कार्यवळेरी आडायात",
"blocklogentry": "$2 $3 हो सोंपपी वेळ आशिल्लो $1 बंद दवरल्ला",
"block-log-flags-nocreate": "खातें निर्माण जावूंक ना",
- "movepagebtn": "पान राà¤\96à¥\82न दवरात",
+ "movepagebtn": "पान हालय",
"movelogpage": "पान हालोवण्यांचो सोत्र",
"revertmove": "मूळ पदार व्हरप",
"export": "पानां निर्यात कर",
"아라"
]
},
+ "tog-underline": "Zoddnienche adhorekhan",
+ "tog-numberheadings": "Mathalle sway kromankit kor",
+ "tog-showtoolbar": "Bodolache hathiar-potti dakhoi",
+ "tog-editondblclick": "Dotti klickacher pananche sonskoron kor",
+ "tog-watchdefault": "Hanv bodolta tim panam moji sadurvollerint zod",
+ "tog-previewontop": "Sonskoron petie mukhar zolok dakhoi",
+ "tog-previewonfirst": "Poileach bodolacher zolok dakhoi",
+ "tog-shownumberswatching": "Nodor dovorpi vangdianche sonkhya dakhoi",
+ "tog-oldsig": "Sodheachi soy:",
+ "tog-uselivepreview": "Boroitastana zolok dahkoi",
+ "tog-watchlisthideown": "Sadurvollerint mhojeo bodlopam lipoi",
+ "tog-watchlisthidebots": "Sadurvollerint robotani kel'lim bodlopam lipoi",
+ "tog-watchlisthideminor": "Sadurvollerint daktim bodlopam lipoi",
+ "tog-showhiddencats": "Lipoiloleo vorg dakhoi",
"underline-always": "Soddankal",
"underline-never": "Kednach na",
+ "underline-default": "Skin vo browsera pormonnem",
+ "editfont-default": "Browsera pormonnem",
"sunday": "Aitar",
"monday": "Somar",
"tuesday": "Munglar",
"category-media-header": "\"$1\" hea vorgan madheom'ma",
"category-empty": "''Hea vorgan sodhea ekui pan vo madheom na''",
"hidden-categories": "{{PLURAL:$1|Lipoilolo vorg|Lipoilole vorg}}",
+ "hidden-category-category": "Lipoiloleo vorg",
"category-subcat-count": "{{PLURAL:$2|Hea vorgan fokot hi ek upvorg asa.|Hea vorgan {{PLURAL:$1|hi upvorg asa|heo $1 upvorg asat}}, beriz $2 upvorga modem.}}",
"category-article-count": "{{PLURAL:$2|Hea vorgan fokot hi ek pan asa.|Hea vorgan {{PLURAL:$1|hi pan asa|him $1 panam asat}} beriz $2 panam modem.}}",
"category-file-count": "{{PLURAL:$2|Hea vorgan fokot hi ek fail asa.|Hea vorgan {{PLURAL:$1|hi fail asa|heo $1 faili asat}}, beriz $2 faili modem.}}",
"article": "Vixoi sombondhi pan",
"newwindow": "(novea zonelant uktem zata)",
"cancel": "Rod'd kor",
+ "moredotdotdot": "Anik...",
+ "morenotlisted": "Hi suchi purn na",
+ "mypage": "Pan",
"mytalk": "Bhasabhas",
"navigation": "Dixa-niontronn",
"and": " ani",
"qbfind": "Sod",
+ "qbbrowse": "Bhovndi mar",
"qbedit": "Bodol",
- "faq": "Choddxe vicharlole prosn",
+ "qbpageoptions": "Hem pan",
+ "qbmyoptions": "Mhoji panam",
+ "faq": "Porot porot vicharlele prosn",
+ "faqpage": "Project:Porot porot vicharlele prosn",
"actions": "Karvaio",
"namespaces": "Nanvthollam",
"variants": "Dusre",
"view": "Poloi",
"view-foreign": "$1-hacher polloi",
"edit": "Bodol",
+ "edit-local": "Thollavem vornon bodol",
"create": "Roch",
"create-local": "Thollavem vornon zod",
"editthispage": "Hem pan bodol",
"blocklogentry": "[[$1]] addailelem $2 asun vellacho ont: $3",
"block-log-flags-nocreate": "Khatem rochop opatr kelam",
"move-watch": "Hea panar disht dovor",
+ "movepagebtn": "Pan haloi",
"movelogpage": "Pan halovneancho sotr",
"movereason": "Karonn:",
"revertmove": "porti",
"createaccount-title": "Otvaranje suradničkog računa za {{SITENAME}}",
"createaccount-text": "Netko je stvorio suradnički račun s Vašom adresom elektronske pošte na {{SITENAME}} ($4) nazvan \"$2\", s lozinkom \"$3\". Trebali biste se prijaviti i odmah promijeniti lozinku.\n\nMožete zanemariti ovu poruku ako je suradnički račun stvoren nenamjerno.",
"login-throttled": "Nedavno ste se previše puta pokušali prijaviti.\nMolimo Vas pričekajte $1 prije nego što pokušate ponovno.",
- "login-abort-generic": "Vaša prijava bila je neuspješna - Prekinuto",
- "login-migrated-generic": "Vaš se suradnički račun preselio, i Vaše suradničko ime više ne postoji u ovom wikiju.",
+ "login-abort-generic": "Vaša je prijava bila neuspješna te je stoga prekinuta.",
+ "login-migrated-generic": "Vaš se suradnički račun preselio, te Vaše suradničko ime više ne postoji u ovom wikiju.",
"loginlanguagelabel": "Jezik: $1",
"suspicious-userlogout": "Vaš zahtjev za odjavu je odbijen jer to izgleda kao da je poslan preko pokvarenog preglednika ili keširanog posrednika (proxyja).",
"createacct-another-realname-tip": "Pravo ime nije obvezno. \nAko ga navedete, bit će korišteno za pripisivanje Vaših doprinosa.",
"protectedtitles": "Zaštićeni naslovi",
"protectedtitlesempty": "Nijedan naslov nije trenutačno zaštićen s tim parametrima.",
"listusers": "Popis suradnika",
- "listusers-editsonly": "Pokaži samo suradnike s uređivanjem",
+ "listusers-editsonly": "Prikaži samo suradnike s uređivanjem",
"listusers-creationsort": "Razvrstaj po datumu stvaranja",
"listusers-desc": "Sortiraj obrnutim redoslijedom",
"usereditcount": "$1 {{PLURAL:$1|uređivanje|uređivanja|uređivanja}}",
"listgrouprights-removegroup-self-all": "Uklonite sve skupine iz vlastitog računa",
"listgrouprights-namespaceprotection-namespace": "Imenski prostor",
"trackingcategories-nodesc": "Opis nije dostupan.",
- "mailnologin": "Nema adrese pošiljaoca",
+ "mailnologin": "Nema adrese pošiljatelja",
"mailnologintext": "Morate biti [[Special:UserLogin|prijavljeni]]\ni imati valjanu adresu e-pošte u svojim [[Special:Preferences|postavkama]]\nda bi mogli slati poštu drugim suradnicima.",
"emailuser": "Pošalji mu e-poruku",
"emailuser-title-target": "Pošalji poruku {{GENDER:$1|suradniku|suradnici|suradniku}}",
"compare-rev1": "Izmjena 1",
"compare-rev2": "Izmjena 2",
"compare-submit": "Usporedite",
- "compare-invalid-title": "Naslov koji ste naveli je nevažeći.",
+ "compare-invalid-title": "Naslov koji ste naveli nije valjan.",
"compare-title-not-exists": "Naslov koji ste naveli ne postoji.",
"compare-revision-not-exists": "Navedena izmjena stranice ne postoji.",
"dberr-problems": "Ispričavamo se! Ova stranica ima tehničkih poteškoća.",
"special-characters-group-greek": "grčki",
"special-characters-group-cyrillic": "ćirilica",
"special-characters-group-arabic": "arapski",
- "special-characters-group-persian": "Perzijski",
+ "special-characters-group-persian": "perzijski",
"special-characters-group-hebrew": "hebrejski",
"special-characters-group-bangla": "Bangla znakovi",
"special-characters-group-telugu": "telugu",
"special-characters-group-sinhala": "Sinhaleški znakovi",
"special-characters-group-gujarati": "Gudžaratski znakovi",
"special-characters-group-thai": "Tajlandski (tajski) znakovi",
- "special-characters-group-lao": "Laoski znakovi",
+ "special-characters-group-lao": "laoski znakovi",
"special-characters-group-khmer": "kmerski",
"mw-widgets-titleinput-description-redirect": "preusmjeravanje na $1"
}
"VASANTH S.N.",
"לערי ריינהארט",
"아라",
- "Pavanaja"
+ "Pavanaja",
+ "Ananth subray"
]
},
"tog-underline": "ಕೊಂಡಿಗಳ ಕೆಳಗೆ ಗೆರೆ ತೋರಿಸಿ",
"changeemail-newemail": "ಹೊಸ ಇ-ಅಂಚೆ ವಿಳಾಸ:",
"changeemail-none": "(ಯಾವೂ ಇಲ್ಲ)",
"changeemail-submit": "ಇಮೇಲ್ ಬದಲಾಯಿಸಿ",
+ "resettokens-tokens": "ಸಂಕೇತಗಳು:",
+ "resettokens-token-label": "$1(ಪ್ರಸ್ತುತ ಮೌಲ್ಯ:$2)",
"bold_sample": "ದಪ್ಪಗಿನ ಅಚ್ಚು",
"bold_tip": "ದಪ್ಪಗಿನ ಅಚ್ಚು",
"italic_sample": "ಓರೆ ಅಕ್ಷರಗಳು",
"edit-no-change": "ನಿಮ್ಮ ಸಂಪಾದನೆಯನ್ನು ಕಡೆಗಣಿಸಲಾಗಿದೆ ಏಕೆಂದರೆ ಪಠ್ಯದಲ್ಲಿ ಯಾವುದೇ ಬದಲಾವಣೆ ಮಾಡಲಾಗಿಲ್ಲ್ಲ",
"postedit-confirmation-saved": "ನಿಮ್ಮ ಸಂಪಾದನೆಯನ್ನು ಉಳಿಸಲಾಗಿದೆ.",
"edit-already-exists": "ಹೊಸ ಪುಟವನ್ನು ಸೃಷ್ಟಿಸಲಾಗಲಿಲ್ಲ.\nಅದು ಆಗಲೆ ಅಸ್ಥಿತ್ವದಲ್ಲಿದೆ.",
+ "content-model-wikitext": "ವಿಕಿ ಪಠ್ಯ",
+ "content-model-text": "ಸರಳ ಪಠ್ಯ",
"content-model-javascript": "ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್",
"content-model-css": "ಸಿಎಸ್ಎಸ್",
+ "content-json-empty-object": "ಖಾಲಿ ವಿಷಯ",
+ "content-json-empty-array": "ಖಾಲಿ ರಚನೆ",
"expensive-parserfunction-warning": "ಎಚ್ಚರಿಕೆ: ಈ ಪುಟದಲ್ಲಿ ಬಹುತೇಕ ದುಬಾರಿ parser function ಕರೆಗಳಿವೆ.\n\nಈಗ {{PLURAL:$1|$1 ಕರೆ|$1 ಕರೆಗಳು}} ಇದ್ದು, $2 {{PLURAL:$2|ಕರೆಗಿಂತ|ಕರೆಗಳಿಗಿಂತ}} ಕಡಿಮೆ ಇರಬೇಕು.",
"expensive-parserfunction-category": "ಬಹುತೇಕ ದುಬಾರಿ parser function ಕರೆಗಳಿರುವ ಪುಟಗಳು",
"post-expand-template-inclusion-warning": "' ' 'ಎಚ್ಚರಿಕೆ:' ' ' ಪುಟದಲ್ಲಿ ಹಕುವ ಛಿತ್ರ ಥೊದಥು. \nಕೆಲವು ಟೆಂಪ್ಲೇಟುಗಳು ಹಕಲಗುದಿಲ್ಲ.",
"histlegend": "ವ್ಯತ್ಯಾಸಗಳ ಆಯ್ಕೆ: ಹೋಲಿಕೆ ಮಾಡಬೇಕು ಎಂದಿರುವ ಎರಡು ಆವೃತ್ತಿಗಳ ಪಕ್ಕದಲ್ಲಿ ಇರುವ ಗುಂಡಿಗಳನ್ನು ಗುರುತು ಮಾಡಿ. ನಂತರ enter ಅನ್ನು ಒತ್ತಿ ಅಥವ ಪಟ್ಟಿಯ ಅಂತ್ಯದಲ್ಲಿರುವ ಗುಂಡಿಯನ್ನು ಒತ್ತಿ.<br />\nಆಖ್ಯಾನ: (ಈಗಿನ) = ಪ್ರಸಕ್ತ ಆವೃತ್ತಿಯೊಂದಿಗೆ ವ್ಯತ್ಯಾಸಗಳು,\n(ಕೊನೆಯ) = ಹಿಂದಿನ ಆವೃತ್ತಿಯೊಂದಿಗೆ ವ್ಯತ್ಯಾಸಗಳು, ಚು = ಚುಟುಕಾದ ಬದಲಾವಣೆ.",
"history-fieldset-title": "ಇತಿಹಾಸವನ್ನು ವಿಹರಿಸಿ",
"history-show-deleted": "ಅಳಿಸಿದ್ದು ಮಾತ್ರ",
- "histfirst": "à²\85ತà³\8dಯà²\82ತ ಮà³\81à²\82à²\9aಿನ",
- "histlast": "à²\85ತà³\8dಯà²\82ತ à²\87ತà³\8dತà³\80à²\9aಿನ",
+ "histfirst": "ಹಳà³\86ಯ",
+ "histlast": "ಹà³\8aಸ",
"historysize": "({{PLURAL:$1|೧ ಬೈಟ್|$1 ಬೈಟ್ಗಳು}})",
"historyempty": "(ಖಾಲಿ)",
"history-feed-title": "ಬದಲಾವಣೆಗಳ ಇತಿಹಾಸ",
"revdelete-hide-text": "ಬದಲಾವಣೆಯ ಪಠ್ಯವನ್ನು ಅಡಗಿಸು",
"revdelete-hide-image": "ಫೈಲಿನಲ್ಲಿರುವ ಮಾಹಿತಿಯನ್ನು ಅಡಗಿಸು",
"revdelete-hide-name": "ಕಾರ್ಯ ಮತ್ತು ಗುರಿಗಳನ್ನು ಅಡಗಿಸು",
- "revdelete-hide-comment": "ಸà²\82ಪಾದನà³\86 ವಿವರಣà³\86 à²\85ಡà²\97ಿಸà³\81",
+ "revdelete-hide-comment": "ಸಾರಾà²\82ಶವನà³\81 ಬದಲಾಯಿಸಿ",
"revdelete-hide-user": "ಸಂಪಾದಕರ ಬಳಕೆಯ ಹೆಸರು/IP ಅಡಗಿಸು",
"revdelete-hide-restricted": "ಈ ನಿಬಂಧನೆಗಳನ್ನು ನಿರ್ವಾಹಕರಿಗೂ ಅನ್ವಯಿಸು ಮತ್ತು ಈ interface ಗೆ ಬೀಗ ಹಾಕು",
"revdelete-radio-same": "(ಬದಲಾಯಿಸಬೇಡಿ)",
"sessionfailure": "Et jov wall e täschnesch Problehm met Dingem Login. Dröm ham_mer dat us Vörseesch jäz nix jemaht, domet mer nit velleich Ding Änderong däm verkihrte Metmaacher ongerjubele. Jangk zeröck un versöhk et noch ens.",
"changecontentmodel-title-label": "Dä Sigg ier Övverschreff",
"changecontentmodel-reason-label": "Der Jrond:",
+ "changecontentmodel-title-cantexist": "Mer kann kein Sigge en $1 aanlähje.",
"logentry-contentmodel-change-revertlink": "retuhr_nämme",
"logentry-contentmodel-change-revert": "retuhr_nämme",
"protectlogpage": "Logbohch vum Sigge Schötze",
"pageinfo-robot-index": "zohjelohße",
"pageinfo-robot-noindex": "verbodde",
"pageinfo-watchers": "De Aanzahl Oppaßßer för di Sigg",
+ "pageinfo-visiting-watchers": "De Aanzahl Metmaacher, di op heh di Sigg oppaße un och de {{lcfirst:{{int:recentchanges}}}} belohre",
"pageinfo-few-watchers": "Et jidd_er winnijer wi {{PLURAL:$1|eine|$1|keine}} Oppaßer.",
+ "pageinfo-few-visiting-watchers": "Et künnd ene Metmaacher javve, dä op heh di Sigg oppaß un och de {{lcfirst:{{int:recentchanges}}}} belohrt — udder och nit.",
"pageinfo-redirects-name": "Ömleidonge op heh di Sigg",
"pageinfo-subpages-name": "Ongersigge vun heh dä Sigg",
"pageinfo-subpages-value": "$1 (dovun {{PLURAL:$2|ein Ömleidong|$2 Ömleidonge|kein Ömleidong}} un {{PLURAL:$3|ein nomahle Sigg|$3 nomahle Sigge|kein nomahle Sigg}})",
"thu": "پشمه",
"fri": "جومَ",
"sat": "شمه",
- "january": "اÛ\89Ù\84 Ù\82Ù\87ارھ",
- "february": "لرشگۉن",
- "march": "ئنهزنۉن",
- "april": "نۉرۉزماھ",
- "may_long": "گلبارماھ",
- "june": "جۉرش",
- "july": "میۉھ رسۉن",
- "august": "مه گرمه",
- "september": "شنیارۉن",
- "october": "Ù\85اÙ\84بارکÙ\86Û\89ن",
- "november": "ئا سردکÙ\86Û\89ن",
- "december": "ئا رجکنۉن",
+ "january": "أڤأÙ\84 Ù\82Ø£Ú¾ارھ",
+ "february": "لیریشگوٙن",
+ "march": "ئنهزینوٙن",
+ "april": "نۉروٙزماھ",
+ "may_long": "گۉلبارماھ",
+ "june": "جۉریش",
+ "july": "میڤە رأسوٙن",
+ "august": "مە گأرمە",
+ "september": "شینیاروٙن",
+ "october": "Ù\85اÙ\84بارکÙ\88Ù\99Ù\86Ù\88Ù\99ن",
+ "november": "ئا سأردکÙ\88Ù\99Ù\86Ù\88Ù\99ن",
+ "december": "ئا ریجیکنوٙن",
"january-gen": "اول قهارھ",
"february-gen": "لرشگون",
"march-gen": "ئنهزنۉن",
"october-gen": "مالبارکنۉن",
"november-gen": "ئا سردکنۉن",
"december-gen": "ئا رجکنۉن",
- "jan": "اÛ\89Ù\84 Ù\82ھارھ",
- "feb": "لرشگۉن",
- "mar": "ئنهزنۉن",
- "apr": "نۉرۉزماھ",
- "may": "گلبار ماھ",
- "jun": "جۉرش",
- "jul": "میۉھ رسۉن",
- "aug": "مه گرمه",
- "sep": "شنیارۉن",
- "oct": "Ù\85اÙ\84بارکÙ\86Û\89ن",
- "nov": "ئا سردکÙ\86Û\89ن",
- "dec": "ئا رجکنۉن",
+ "jan": "أڤأÙ\84 Ù\82Ø£ھارھ",
+ "feb": "لیریشگوٙن",
+ "mar": "ئنهزینوٙن",
+ "apr": "نۉروٙزماھ",
+ "may": "Ú¯Ù\88Ù\99Ù\84بار Ù\85اھ",
+ "jun": "جوٙریش",
+ "jul": "میڤە رأسوٙن",
+ "aug": "مە گأرمە",
+ "sep": "شینیاروٙن",
+ "oct": "Ù\85اÙ\84بارکÙ\88Ù\99Ù\86Ù\88Ù\99ن",
+ "nov": "ئا سأردکÙ\88Ù\99Ù\86Ù\88Ù\99ن",
+ "dec": "ئا ریجکنوٙن",
"january-date": "ژانویه $1",
"february-date": "فوریه $1",
"march-date": "مارس $1",
"returnto": "بازگشت وھ $1.",
"tagline": "ز {{SITENAME}}",
"help": "هومیاری",
- "search": "جستن",
- "searchbutton": "جستن",
+ "search": "جۉستأن",
+ "searchbutton": "جۉستأن",
"go": "رو",
"searcharticle": "رۉ",
"history": "تاریخچھ بلگه",
"history_short": "تاریخچه",
"updatedmarker": "بروز وابی تا موقع آخرین سیل کردن مو",
- "printableversion": "ۉرژن سی چاپ",
+ "printableversion": "ۉیرژین سی چاپ",
"permalink": "لینکل دائمی",
"print": "چاپ",
"view": "نما",
"unprotectthispage": "تغییر دائن حالت حفاظت ای بلگه",
"newpage": "بلگه نۉ",
"talkpage": "گپ زئن ای بلگه",
- "talkpagelinktext": "گپ",
+ "talkpagelinktext": "گأپ",
"specialpage": "بلگه مخصوص",
"personaltools": "اۉزارگل سی خۉتی",
"articlepage": "سل کردن محتوا ای بلگه",
"pool-queuefull": "صف استخر پر هسی",
"pool-errorunknown": "خطا ناشناخته",
"pool-servererror": "شمارنده سرویس استخر ور تیه نی ($1).",
- "aboutsite": "پرۉجھ : دربارھ",
- "aboutpage": "Project:دربارھ",
+ "aboutsite": "پۉرۉجھ : دأربارھ",
+ "aboutpage": "Project:دأربارھ",
"copyright": "مطلب دومن $ 1 هس نکه خلاف هونو ذکر وابی.",
"copyrightpage": "{{ns:project}}:کپی رایت",
"currentevents": "اتفاقل جاری",
"currentevents-url": "Project:اتفاقل جاری",
- "disclaimers": "انکار کنندھ یل",
- "disclaimerpage": "Project:اÙ\86کار کارÛ\89ران",
+ "disclaimers": "ئÛ\8cنکار کنندھ یل",
+ "disclaimerpage": "Project:ئÛ\8cÙ\86کار کارÛ\89Ø£ران",
"edithelp": "هۉمیاری سی اصلاح",
- "mainpage": "بلگھ اصلی",
+ "mainpage": "بألگە أصلی",
"mainpage-description": "بلگھ اصلی",
"policy-url": "Project:خط مشی",
"portal": "درگاھ کارۉران",
"portal-url": "Project:درگاھ کارۉران",
- "privacy": "خط مشی رازداری",
- "privacypage": "Project:خط مشی رازداری",
+ "privacy": "خط Ù\85أشÛ\8c رازدارÛ\8c",
+ "privacypage": "Project:خط Ù\85أشÛ\8c رازدارÛ\8c",
"badaccess": "خطا دسترسی",
"badaccess-group0": "ایسا اجازه انجام کاری که ایخستیده ندارین",
"badaccess-groups": "او کاری که ایسا درخواست کردین فقط سی کارورانیه که مئنه ای گروهن {{PLURAL:$2|آن گروه|یکی زه گروه یل}}: $1.",
"versionrequired": "یه نسخه زه نیازمندی یل ویکی مدیا\n$1",
"versionrequiredtext": "یه نسخه زه ویکی مدیا($1) نیازمند ه وه استفاده زه ای بلگه\nبویین :[[مخصوص:نسخه|نسخه مخصوص]].",
"ok": "خووه",
- "retrievedfrom": "بازیافت ز\"$1\"",
+ "retrievedfrom": "بازیافت زھ \"$1\"",
"youhavenewmessages": "پیوم نو داری $1 ($2).",
"youhavenewmessagesfromusers": "{{PLURAL:$4|ایشا داریت}} $1 زه {{PLURAL:$3|یه کارور دیه|$3 کارورل}} ($2).",
"youhavenewmessagesmanyusers": "ایشا $1 زه کارورل دیه داریت ($2).",
"newmessageslinkplural": "{{PLURAL:$1|یه پیوم نو|999=پیومل نو}}",
"newmessagesdifflinkplural": "آخر {{PLURAL:$1|تغییر|999=تغییرل}}",
"youhavenewmessagesmulti": "ایشا پیوم نو داریت مئنه\n$1",
- "editsection": "اصلاح",
+ "editsection": "ئÛ\8cصلاح",
"editold": "اصلاح",
"viewsourceold": "دیئن منبع",
"editlink": "اصلاح",
"viewsourcelink": "دیئن سرچشمھ",
- "editsectionhint": "اصÙ\84Ø§Ø Û\89Ú¾ Ù\82سÙ\85ت: $1",
+ "editsectionhint": "ئÛ\8cصÙ\84Ø§Ø Ø¦Û\8c بأخش: $1",
"toc": "محتوا یل",
"showtoc": "نمایش",
"hidetoc": "قائم",
"site-atom-feed": "خبرخۉ Atom سی $1",
"page-rss-feed": "خبرخو RSS سی «$1»",
"page-atom-feed": "خبرخۉ Atom سی «$1»",
- "red-link-title": "(بلگھ ۉجود نارھ) $1",
+ "red-link-title": "(بألگە ۉجوٙد نارھ) $1",
"sort-descending": "مرتب سازی وا صعودی",
"sort-ascending": "مرتب سازی وا صعودی",
"nstab-main": "بلگھ",
"minoreditletter": "رز",
"newpageletter": "تا",
"boteditletter": "ر",
- "rc-change-size-new": "$1 {{PLURAL:$1|باÛ\8cت|باÛ\8cتÙ\84}} بعد تغییر",
+ "rc-change-size-new": "$1 {{PLURAL:$1|باÛ\8cت|باÛ\8cتÙ\84}} بأعد تأغییر",
"recentchangeslinked": "تغییرل مربۉط",
"recentchangeslinked-toolbox": "تغییرل مربوط",
"recentchangeslinked-title": "تغییرل مرتبط ۉا $1",
"whatlinkshere-hidelinks": "$1 لینکل",
"whatlinkshere-filters": "فیلترل",
"blocklink": "بسه بۉھ",
- "contribslink": "شراکتل",
+ "contribslink": "شۉراکأتل",
"movelogpage": "نمایه جابجایی",
"export": "بلگل صادرھ",
"thumbnail-more": "گپ کردن",
"nohistory": "Chit ia̍h bô pian-chi̍p-sú.",
"currentrev": "Hiān-chú-sî ê siu-tēng-pún",
"revisionasof": "$1 ê siu-tēng-pún",
- "previousrevision": "←Khah kū ê siu-tēng-pún",
- "nextrevision": "Khah sin ê siu-tēng-pún→",
+ "previousrevision": "←Khah-kū ê siu-tēng-pún",
+ "nextrevision": "Khah-sin ê siu-tēng-pún→",
"currentrevisionlink": "khoàⁿ siōng sin ê siu-tēng-pún",
"cur": "taⁿ",
"next": "下一个",
"Urhixidur",
"Val2397",
"아라",
- "Leeheonjin"
+ "Leeheonjin",
+ "TTO"
]
},
"tog-underline": "Gulisan lang panglalam deng suglung:",
"tooltip-pt-logout": "Mag log out",
"tooltip-ca-talk": "Pamisabi-sabi tungkul king bulung kalamnan (content page)",
"tooltip-ca-edit": "Malyari meng samasan ing bulung a ini. Pakigamit me pamu ing \"pasinag a pipindutan\" bayu me isikap.",
- "tooltip-ca-addsection": "Mangibili kang bayung dake o ''section''.",
+ "tooltip-ca-addsection": "Mangibili kang bayung dake o \"section\".",
"tooltip-ca-viewsource": "Protektadu/makakambil ya ing bulung a ini. Malyari meng lon ing kayang pikuanan (source).",
"tooltip-ca-history": "Deng milabas a bersion ning bulung a ini.",
"tooltip-ca-protect": "Protektan/kambilan ya ing bulung a ini",
"tooltip-pt-logout": "Wyloguj",
"tooltip-pt-createaccount": "Zachęcamy do stworzenia konta i zalogowania, ale nie jest to konieczne.",
"tooltip-ca-talk": "Dyskusja o zawartości tej strony",
- "tooltip-ca-edit": "Edytuj tę stronę.",
+ "tooltip-ca-edit": "Edytuj tę stronę",
"tooltip-ca-addsection": "Dodaj nowy wątek.",
"tooltip-ca-viewsource": "Ta strona jest zabezpieczona. Możesz zobaczyć tekst źródłowy.",
"tooltip-ca-history": "Starsze wersje tej strony.",
"Totosunarto",
"Macofe",
"FRacco",
- "Robin0van0der0vliet"
+ "Robin0van0der0vliet",
+ "TTO"
]
},
"sidebar": "{{notranslate}}",
"changecontentmodel-success-title": "Title of the success page of the change content model special page",
"changecontentmodel-success-text": "Message telling user that their change has been successfully done.\n* $1 - Target page title",
"changecontentmodel-cannot-convert": "Error message shown if the content model cannot be changed to the specified type. $1 is the page title, $2 is the localized content model name.",
- "changecontentmodel-title-cantexist": "Error message shown if the page the user provided is a special page",
+ "changecontentmodel-title-cantexist": "Error message shown if the page the user provided is a special page.\n\nParameters:\n* $1 - the page title which cannot exist",
"changecontentmodel-nodirectediting": "Error message shown if the content model does not allow for direct editing. $1 is the localized name of the content model.",
"log-name-contentmodel": "{{doc-logpage}}\n\nTitle of [[Special:Log/contentmodel]].",
"log-description-contentmodel": "Text in [[Special:Log/contentmodel]].",
"creating": "Skapar $1",
"editingsection": "Redigerar $1 (avsnitt)",
"editingcomment": "Redigerar $1 (nytt avsnitt)",
- "editconflict": "Dina ändringar kunde inte sparas på grund av en redigeringskonflikt. Vill {{GENDER:|du}} lösa konflikten manuellt?",
+ "editconflict": "Redigeringskonflikt: $1",
"explainconflict": "Någon har ändrat den här sidan efter att du började att redigera den.\nDen översta textrutan innehåller den nuvarande sparade versionen av texten.\nDin ändrade version visas i den nedre rutan.\nOm du vill spara dina ändringar så måste du infoga dem i den övre texten.\n'''Endast''' texten i den översta textrutan kommer att sparas när du trycker på \"{{int:savearticle}}\".",
"yourtext": "Din text",
"storedversion": "Den sparade versionen",
"right-passwordreset": "Visa e-postmeddelanden med lösenordsåterställning",
"right-managechangetags": "Skapa och radera [[Special:Tags|taggar]] från databasen",
"right-applychangetags": "Tillämpa [[Special:Tags|taggar]] tillsammans med ens ändringar",
+ "right-changetags": "Lägg till och ta bort godtyckliga [[Special:Tags|märken]] på individuella sidversioner och loggposter.",
"newuserlogpage": "Logg över nya användare",
"newuserlogpagetext": "Detta är en logg över nya användarkonton.",
"rightslog": "Användarrättighetslogg",
"action-editcontentmodel": "ändra innehållsmodellen för en sida",
"action-managechangetags": "skapa och radera taggar från databasen",
"action-applychangetags": "tillämpa taggar tillsammans med dina ändringar",
+ "action-changetags": "lägg till och ta bort godtyckliga märken på individuella sidversioner och loggposter",
"nchanges": "$1 {{PLURAL:$1|ändring|ändringar}}",
"enhancedrc-since-last-visit": "$1 {{PLURAL:$1|sedan senaste besöket}}",
"enhancedrc-history": "historik",
"rollback-success": "Återställde ändringar av $1;\nändrade tillbaka till senaste version av $2.",
"sessionfailure-title": "Sessionsfel",
"sessionfailure": "Något med din session som inloggad är på tok. Din begärda åtgärd har avbrutits, för att förhindra att någon kapar din session. Klicka på \"Tillbaka\" i din webbläsare och ladda om den sida du kom ifrån. Försök sedan igen.",
+ "changecontentmodel": "Ändra innehållsmodell för en sida",
+ "changecontentmodel-legend": "Ändra innehållsmodell",
"changecontentmodel-title-label": "Sidtitel",
+ "changecontentmodel-model-label": "Ny innehållsmodell",
"changecontentmodel-reason-label": "Orsak:",
+ "changecontentmodel-success-title": "Innehållsmodellen ändrades",
+ "changecontentmodel-success-text": "Innehållstypen för [[:$1]] har ändrats.",
+ "changecontentmodel-cannot-convert": "Innehållet på [[:$1]] kan inte konverteras till typen $2.",
+ "changecontentmodel-title-cantexist": "Det går inte att ha en sida på $1.",
+ "changecontentmodel-nodirectediting": "Innehållsmodellen $1 stöder inte direkt redigering",
+ "log-name-contentmodel": "Ändringslogg för innehållsmodellen",
+ "log-description-contentmodel": "Händelser som är relaterade till en sidas innehållsmodeller",
+ "logentry-contentmodel-change": "$1 {{GENDER:$2|ändrade}} innehållsmodellen för sidan $3 från \"$4\" till \"$5\"",
"logentry-contentmodel-change-revertlink": "återställ",
"logentry-contentmodel-change-revert": "återställ",
"protectlogpage": "Skrivskyddslogg",
"deletedwhileediting": "'''Varning''': Denna sida raderades efter att du började redigera!",
"confirmrecreate": "Användaren [[User:$1|$1]] ([[User talk:$1|diskussion]]) raderade den här sidan efter att du började redigera den med motiveringen:\n: ''$2''\nBekräfta att du verkligen vill återskapa sidan.",
"confirmrecreate-noreason": "Användare [[User:$1|$1]] ([[User talk:$1|diskussion]]) raderade den här sidan efter att du började redigera. Bekräfta att du verkligen vill återskapa sidan.",
- "recreate": "Sidan har raderats sedan du började redigera. Tryck \"$1\" för att återskapa den.",
+ "recreate": "Återskapa",
"confirm_purge_button": "OK",
"confirm-purge-top": "Rensa denna sidas cache?",
"confirm-purge-bottom": "Rensning av en sida tömmer cachen och tvingar fram den senaste versionen.",
"creating": "创建“$1”",
"editingsection": "编辑“$1(段落)”",
"editingcomment": "编辑“$1”(新段落)",
- "editconflict": "您的更改因为编辑冲突无法保存。{{GENDER:|您}}希望手动解决冲突吗?",
+ "editconflict": "编辑冲突:$1",
"explainconflict": "其他用户在你开始编辑后更改了该页面。上面的文字区含有该页面当前的文字。下面的文字区显示你的更改。你必须把你的更改合并至现有文字。'''只有'''当你单击“{{int:savearticle}}”后,上面的文字区中的文字才会被保存。",
"yourtext": "您的文字",
"storedversion": "已保存的版本",
"deletedwhileediting": "'''警告''':此页在您开始编辑之后已经被删除!",
"confirmrecreate": "在您开始编辑这个页面后,用户[[User:$1|$1]] ([[User talk:$1|讨论]])以下列原因删除了这个页面:\n: ''$2''\n请确认在您重新创建页面前三思。",
"confirmrecreate-noreason": "用户 [[User:$1|$1]]([[User talk:$1|talk]]) 在您开始编辑之后删除此页面。请确认您确实要重新创建此页面。",
- "recreate": "此页面自从您开始编辑以来已被删除。请点击“$1”以重新创建。",
+ "recreate": "重新创建",
"confirm_purge_button": "确定",
"confirm-purge-top": "要清除此页面的缓存吗?",
"confirm-purge-bottom": "清除页面数据会清除缓存并强制显示最近的版本。",
'Booksources' => array( 'BookSources' ),
'BrokenRedirects' => array( 'BrokenRedirects' ),
'Categories' => array( 'Categories' ),
+ 'ChangeContentModel' => array( 'ChangeContentModel' ),
'ChangeEmail' => array( 'ChangeEmail' ),
'ChangePassword' => array( 'ChangePassword', 'ResetPass', 'ResetPassword' ),
'ComparePages' => array( 'ComparePages' ),
"Taha",
"درفش کاویانی",
"Armin1392",
- "Alirezaaa"
+ "Alirezaaa",
+ "Leyth"
]
},
"ooui-outline-control-move-down": "انتقال مورد به پایین",
"ooui-dialog-process-error": "مشکلی وجود دارد",
"ooui-dialog-process-dismiss": "نپذیرفتن",
"ooui-dialog-process-retry": "دوباره امتحان کن",
- "ooui-dialog-process-continue": "ادامه"
+ "ooui-dialog-process-continue": "ادامه",
+ "ooui-selectfile-not-supported": "انتخاب پرونده پشتیبانی نمیشود",
+ "ooui-selectfile-placeholder": "هیچ پروندهای انتخاب نشدهاست"
}
"authors": [
"Audriusa",
"Eitvys200",
- "Mantak111"
+ "Mantak111",
+ "Albertas"
]
},
- "ooui-outline-control-remove": "Šalinti elementus"
+ "ooui-outline-control-move-down": "Perkelti elementą žemyn",
+ "ooui-outline-control-move-up": "Perkelti elementą aukštyn",
+ "ooui-outline-control-remove": "Šalinti elementus",
+ "ooui-toolbar-more": "Daugiau",
+ "ooui-toolgroup-expand": "Daugiau",
+ "ooui-toolgroup-collapse": "Mažiau",
+ "ooui-dialog-message-accept": "Gerai",
+ "ooui-dialog-message-reject": "Atšaukti",
+ "ooui-dialog-process-error": "Kažkas nutiko ne taip",
+ "ooui-dialog-process-dismiss": "Paslėpti",
+ "ooui-dialog-process-retry": "Bandykite dar kartą",
+ "ooui-dialog-process-continue": "Tęsti",
+ "ooui-selectfile-not-supported": "Failų pasirinkimas nepalaikomas",
+ "ooui-selectfile-placeholder": "Nėra pasirinktų failų"
}
"ooui-outline-control-move-up": "ਉੱਤੇ ਲੈਕੇ ਜਾਓ",
"ooui-toolbar-more": "ਹੋਰ",
"ooui-toolgroup-expand": "ਹੋਰ",
- "ooui-toolgroup-collapse": "ਥੋੜੇ",
+ "ooui-toolgroup-collapse": "ਥà©\8bà©\9cà©\8dਹà©\87",
"ooui-dialog-message-accept": "ਠੀਕ ਹੈ",
"ooui-dialog-message-reject": "ਰੱਦ ਕਰੋ",
"ooui-dialog-process-error": "ਕੁਝ ਗਲਤ ਹੋ ਗਿਆ",
"ooui-dialog-message-reject": "ناگارل",
"ooui-dialog-process-error": "يوه ستونزه رامنځ ته شوه",
"ooui-dialog-process-dismiss": "تړل",
- "ooui-dialog-process-retry": "بيا هڅه"
+ "ooui-dialog-process-retry": "بيا هڅه",
+ "ooui-dialog-process-continue": "پرله پورې",
+ "ooui-selectfile-not-supported": "د دوتنې د ټاکنې ملاتړ نه دی شوی",
+ "ooui-selectfile-placeholder": "کومه دوتنه نه ده ټاکل شوې"
}
"ooui-dialog-process-error": "Что-то пошло не так",
"ooui-dialog-process-dismiss": "Закрыть",
"ooui-dialog-process-retry": "Попробовать ещё раз",
- "ooui-dialog-process-continue": "Продолжить"
+ "ooui-dialog-process-continue": "Продолжить",
+ "ooui-selectfile-not-supported": "Выбор файла не поддерживается"
}
"ooui-outline-control-move-up": "רוקן עלעמענט ארויף",
"ooui-outline-control-remove": "אַראָפנעמען איינס",
"ooui-toolbar-more": "נאך",
+ "ooui-toolgroup-expand": "נאך",
+ "ooui-toolgroup-collapse": "ווייניגער",
"ooui-dialog-message-accept": "יאָ",
"ooui-dialog-message-reject": "אַנולירן",
"ooui-dialog-process-error": "עפעס איז דורכגעפאלן",
"ooui-dialog-process-dismiss": "צומאַכן",
- "ooui-dialog-process-retry": "פרובירט נאכאמאל"
+ "ooui-dialog-process-retry": "פרובירט נאכאמאל",
+ "ooui-dialog-process-continue": "פֿארזעצן",
+ "ooui-selectfile-not-supported": "טעקע אויסווייל נישט געשטיצט",
+ "ooui-selectfile-placeholder": "קיין טעקע נישט אויסגעוויילט"
}
"@metadata": {
"authors": [
"Deryck Chan",
- "William915"
+ "William915",
+ "Shinjiman"
]
},
"ooui-outline-control-move-down": "向下搬",
"ooui-outline-control-move-up": "向上搬",
"ooui-outline-control-remove": "拎走",
- "ooui-toolbar-more": "仲有...",
+ "ooui-toolbar-more": "仲有",
"ooui-toolgroup-expand": "更多",
"ooui-dialog-message-accept": "好",
"ooui-dialog-message-reject": "取消",
/*!
- * OOjs UI v0.11.7
+ * OOjs UI v0.11.8
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2015 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2015-07-01T19:04:35Z
+ * Date: 2015-07-08T01:31:46Z
*/
@-webkit-keyframes oo-ui-progressBarWidget-slide {
from {
/*!
- * OOjs UI v0.11.7
+ * OOjs UI v0.11.8
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2015 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2015-07-01T19:04:28Z
+ * Date: 2015-07-08T01:31:38Z
*/
/**
* @class
/*!
- * OOjs UI v0.11.7
+ * OOjs UI v0.11.8
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2015 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2015-07-01T19:04:35Z
+ * Date: 2015-07-08T01:31:46Z
*/
@-webkit-keyframes oo-ui-progressBarWidget-slide {
from {
width: 1.875em;
height: 1.875em;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ) > .oo-ui-buttonElement-button:focus {
+.oo-ui-buttonElement-frameless > .oo-ui-buttonElement-button:focus {
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.2);
outline: none;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ) > .oo-ui-buttonElement-button .oo-ui-indicatorElement-indicator {
+.oo-ui-buttonElement-frameless > .oo-ui-buttonElement-button .oo-ui-indicatorElement-indicator {
margin-right: 0;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
margin-left: 0.25em;
margin-right: 0.25em;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ) > input.oo-ui-buttonElement-button {
+.oo-ui-buttonElement-frameless > input.oo-ui-buttonElement-button {
padding-left: 0.25em;
padding-right: 0.25em;
color: #333333;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled > input.oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled > input.oo-ui-buttonElement-button,
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
color: #555555;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-buttonElement-pressed > input.oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > input.oo-ui-buttonElement-button,
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
color: #444444;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:hover > .oo-ui-labelElement-label,
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:focus > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:hover > .oo-ui-labelElement-label,
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:focus > .oo-ui-labelElement-label {
color: #347bff;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
color: #777777;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active > .oo-ui-labelElement-label,
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active > .oo-ui-labelElement-label,
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
color: #1f4999;
box-shadow: none;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:hover > .oo-ui-labelElement-label,
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:focus > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:hover > .oo-ui-labelElement-label,
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:focus > .oo-ui-labelElement-label {
color: #00af89;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
color: #777777;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active > .oo-ui-labelElement-label,
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active > .oo-ui-labelElement-label,
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
color: #005946;
box-shadow: none;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:hover > .oo-ui-labelElement-label,
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:focus > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:hover > .oo-ui-labelElement-label,
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:focus > .oo-ui-labelElement-label {
color: #d11d13;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
color: #777777;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active > .oo-ui-labelElement-label,
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active > .oo-ui-labelElement-label,
+.oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
color: #73100a;
box-shadow: none;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-disabled > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-frameless.oo-ui-widget-disabled > .oo-ui-buttonElement-button {
color: #cccccc;
}
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-disabled > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon,
-.oo-ui-buttonElement-frameless:not( .oo-ui-flaggedElement-primary ).oo-ui-widget-disabled > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator {
+.oo-ui-buttonElement-frameless.oo-ui-widget-disabled > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon,
+.oo-ui-buttonElement-frameless.oo-ui-widget-disabled > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator {
opacity: 0.2;
}
.oo-ui-buttonElement-framed > .oo-ui-buttonElement-button {
margin: 0.1em 0;
padding: 0.2em 0.8em;
border-radius: 2px;
-}
-.oo-ui-buttonElement-framed > input.oo-ui-buttonElement-button,
-.oo-ui-buttonElement-framed.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
- line-height: 1.875em;
-}
-.oo-ui-buttonElement-framed.oo-ui-widget-disabled > .oo-ui-buttonElement-button {
- border: 1px solid #dddddd;
-}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button {
- border: 1px solid #cdcdcd;
-}
-.oo-ui-buttonElement-framed > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary > .oo-ui-buttonElement-button {
-webkit-transition: background 0.1s ease-in-out, color 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
-moz-transition: background 0.1s ease-in-out, color 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
-ms-transition: background 0.1s ease-in-out, color 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
transition: background 0.1s ease-in-out, color 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
}
.oo-ui-buttonElement-framed > .oo-ui-buttonElement-button:hover,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary > .oo-ui-buttonElement-button:hover,
-.oo-ui-buttonElement-framed > .oo-ui-buttonElement-button:focus,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary > .oo-ui-buttonElement-button:focus {
+.oo-ui-buttonElement-framed > .oo-ui-buttonElement-button:focus {
outline: none;
}
-.oo-ui-buttonElement-framed.oo-ui-iconElement > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-iconElement > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon {
+.oo-ui-buttonElement-framed > input.oo-ui-buttonElement-button,
+.oo-ui-buttonElement-framed.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
+ line-height: 1.875em;
+}
+.oo-ui-buttonElement-framed.oo-ui-iconElement > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon {
margin-left: -0.5em;
margin-right: -0.5em;
}
-.oo-ui-buttonElement-framed.oo-ui-iconElement.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-iconElement.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon {
+.oo-ui-buttonElement-framed.oo-ui-iconElement.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon {
margin-right: 0.3em;
}
-.oo-ui-buttonElement-framed.oo-ui-indicatorElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-indicatorElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator {
+.oo-ui-buttonElement-framed.oo-ui-indicatorElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator {
/* -0.5 - 0.475 */
margin-left: -0.005em;
margin-right: -0.005em;
}
.oo-ui-buttonElement-framed.oo-ui-indicatorElement.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-indicatorElement.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator,
-.oo-ui-buttonElement-framed.oo-ui-indicatorElement.oo-ui-iconElement:not( .oo-ui-labelElement ) > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-indicatorElement.oo-ui-iconElement:not( .oo-ui-labelElement ) > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator {
+.oo-ui-buttonElement-framed.oo-ui-indicatorElement.oo-ui-iconElement:not( .oo-ui-labelElement ) > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator {
margin-left: 0.46875em;
margin-right: -0.275em;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-disabled > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-disabled > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-disabled > .oo-ui-buttonElement-button {
color: #ffffff;
background: #dddddd;
+ border: 1px solid #dddddd;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button {
color: #555555;
background-color: #ffffff;
+ border: 1px solid #cdcdcd;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button:hover,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled > .oo-ui-buttonElement-button:hover {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button:hover {
background-color: #ebebeb;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button:focus,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled > .oo-ui-buttonElement-button:focus {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button:focus {
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
background-color: #d9d9d9;
border-color: #d9d9d9;
box-shadow: none;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
background-color: #999999;
color: #ffffff;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button {
color: #347bff;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:hover,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:hover {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:hover {
background-color: rgba(52, 123, 255, 0.1);
border-color: rgba(31, 73, 153, 0.5);
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:focus,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:focus {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:focus {
box-shadow: inset 0 0 0 1px #1f4999;
border-color: #1f4999;
}
.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
color: #1f4999;
border-color: #1f4999;
box-shadow: none;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
background-color: #999999;
color: #ffffff;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button {
color: #00af89;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:hover,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:hover {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:hover {
background-color: rgba(0, 171, 137, 0.1);
border-color: rgba(0, 89, 70, 0.5);
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:focus,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:focus {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:focus {
box-shadow: inset 0 0 0 1px #005946;
border-color: #005946;
}
.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
color: #005946;
border-color: #005946;
box-shadow: none;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
background-color: #999999;
color: #ffffff;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button {
color: #d11d13;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:hover,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:hover {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:hover {
background-color: rgba(209, 29, 19, 0.1);
border-color: rgba(115, 16, 10, 0.5);
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:focus,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:focus {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:focus {
box-shadow: inset 0 0 0 1px #73100a;
border-color: #73100a;
}
.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
color: #73100a;
border-color: #73100a;
box-shadow: none;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
background-color: #999999;
color: #ffffff;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button {
color: #ffffff;
background-color: #347bff;
border-color: #347bff;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:hover,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:hover {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:hover {
background: #2962cc;
border-color: #2962cc;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:focus,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:focus {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:focus {
box-shadow: inset 0 0 0 1px #ffffff;
border-color: #347bff;
}
.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
color: #ffffff;
background-color: #1f4999;
border-color: #1f4999;
box-shadow: none;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
background-color: #999999;
color: #ffffff;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button {
color: #ffffff;
background-color: #00af89;
border-color: #00af89;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:hover,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:hover {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:hover {
background: #008064;
border-color: #008064;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:focus,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:focus {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:focus {
box-shadow: inset 0 0 0 1px #ffffff;
border-color: #00af89;
}
.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
color: #ffffff;
background-color: #005946;
border-color: #005946;
box-shadow: none;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
background-color: #999999;
color: #ffffff;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button {
color: #ffffff;
background-color: #d11d13;
border-color: #d11d13;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:hover,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:hover {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:hover {
background: #8c130d;
border-color: #8c130d;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:focus,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:focus {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:focus {
box-shadow: inset 0 0 0 1px #ffffff;
border-color: #d11d13;
}
.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled .oo-ui-buttonElement-button:active,
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button {
color: #ffffff;
background-color: #73100a;
border-color: #73100a;
box-shadow: none;
}
-.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button,
-.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-primary.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
+.oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button {
background-color: #999999;
color: #ffffff;
}
background: none;
box-shadow: none;
}
-.oo-ui-toolbar-actions > .oo-ui-buttonElement-framed,
-.oo-ui-toolbar-actions > .oo-ui-buttonElement-framed:last-child {
- margin-top: 0.25em;
- margin-bottom: 0.25em;
- margin-right: 0.5em;
-}
-.oo-ui-toolbar-actions > .oo-ui-buttonElement-frameless.oo-ui-labelElement {
+.oo-ui-toolbar-actions > .oo-ui-buttonElement.oo-ui-labelElement {
margin: 0;
}
-.oo-ui-toolbar-actions > .oo-ui-buttonElement-frameless.oo-ui-labelElement > .oo-ui-buttonElement-button {
+.oo-ui-toolbar-actions > .oo-ui-buttonElement.oo-ui-labelElement > .oo-ui-buttonElement-button {
+ border: 0;
+ border-radius: 0;
+ margin: 0;
padding: 1.0546875em 0.3125em;
}
-.oo-ui-toolbar-actions > .oo-ui-buttonElement-frameless.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
+.oo-ui-toolbar-actions > .oo-ui-buttonElement.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label {
margin: 0 1em;
+ line-height: inherit;
}
.oo-ui-optionWidget {
position: relative;
/*!
- * OOjs UI v0.11.7
+ * OOjs UI v0.11.8
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2015 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2015-07-01T19:04:28Z
+ * Date: 2015-07-08T01:31:38Z
*/
/**
* @class
/*!
- * OOjs UI v0.11.7
+ * OOjs UI v0.11.8
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2015 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2015-07-01T19:04:28Z
+ * Date: 2015-07-08T01:31:38Z
*/
( function ( OO ) {
*/
OO.ui.Element.static.getClosestScrollableContainer = function ( el, dimension ) {
var i, val,
- props = [ 'overflow' ],
+ // props = [ 'overflow' ] doesn't work due to https://bugzilla.mozilla.org/show_bug.cgi?id=889091
+ props = [ 'overflow-x', 'overflow-y' ],
$parent = $( el ).parent();
if ( dimension === 'x' || dimension === 'y' ) {
- props.push( 'overflow-' + dimension );
+ props = [ 'overflow-' + dimension ];
}
while ( $parent.length ) {
* @inheritdoc
*/
OO.ui.DropdownInputWidget.prototype.setValue = function ( value ) {
+ value = this.cleanUpValue( value );
this.dropdownWidget.getMenu().selectItemByData( value );
OO.ui.DropdownInputWidget.parent.prototype.setValue.call( this, value );
return this;
* @chainable
*/
OO.ui.DropdownInputWidget.prototype.setOptions = function ( options ) {
- var value = this.getValue();
+ var
+ value = this.getValue(),
+ widget = this;
// Rebuild the dropdown menu
this.dropdownWidget.getMenu()
.clearItems()
.addItems( options.map( function ( opt ) {
+ var optValue = widget.cleanUpValue( opt.data );
return new OO.ui.MenuOptionWidget( {
- data: opt.data,
- label: opt.label !== undefined ? opt.label : opt.data
+ data: optValue,
+ label: opt.label !== undefined ? opt.label : optValue
} );
} ) );
* @inheritdoc
*/
OO.ui.RadioSelectInputWidget.prototype.setValue = function ( value ) {
+ value = this.cleanUpValue( value );
this.radioSelectWidget.selectItemByData( value );
OO.ui.RadioSelectInputWidget.parent.prototype.setValue.call( this, value );
return this;
* @chainable
*/
OO.ui.RadioSelectInputWidget.prototype.setOptions = function ( options ) {
- var value = this.getValue();
+ var
+ value = this.getValue(),
+ widget = this;
// Rebuild the radioSelect menu
this.radioSelectWidget
.clearItems()
.addItems( options.map( function ( opt ) {
+ var optValue = widget.cleanUpValue( opt.data );
return new OO.ui.RadioOptionWidget( {
- data: opt.data,
- label: opt.label !== undefined ? opt.label : opt.data
+ data: optValue,
+ label: opt.label !== undefined ? opt.label : optValue
} );
} ) );
* @cfg {boolean} [readOnly=false] Prevent changes to the value of the text input.
* @cfg {number} [maxLength] Maximum number of characters allowed in the input.
* @cfg {boolean} [multiline=false] Allow multiple lines of text
+ * @cfg {number} [rows] If multiline, number of visible lines in textarea. If used with `autosize`,
+ * specifies minimum number of rows to display.
* @cfg {boolean} [autosize=false] Automatically resize the text input to fit its content.
* Use the #maxRows config to specify a maximum number of displayed rows.
- * @cfg {boolean} [maxRows=10] Maximum number of rows to display when #autosize is set to true.
+ * @cfg {boolean} [maxRows] Maximum number of rows to display when #autosize is set to true.
+ * Defaults to the maximum of `10` and `2 * rows`, or `10` if `rows` isn't provided.
* @cfg {string} [labelPosition='after'] The position of the inline label relative to that of
* the value or placeholder text: `'before'` or `'after'`
* @cfg {boolean} [required=false] Mark the field as required
+ * @cfg {boolean} [autocomplete=true] Should the browser support autocomplete for this field
* @cfg {RegExp|Function|string} [validate] Validation pattern: when string, a symbolic name of a
* pattern defined by the class: 'non-empty' (the value cannot be an empty string) or 'integer'
* (the value must contain only numbers); when RegExp, a regular expression that must match the
// Configuration initialization
config = $.extend( {
type: 'text',
- labelPosition: 'after',
- maxRows: 10
+ labelPosition: 'after'
}, config );
// Parent constructor
this.readOnly = false;
this.multiline = !!config.multiline;
this.autosize = !!config.autosize;
- this.maxRows = config.maxRows;
+ this.minRows = config.rows !== undefined ? config.rows : '';
+ this.maxRows = config.maxRows || Math.max( 2 * ( this.minRows || 0 ), 10 );
this.validate = null;
// Clone for resizing
this.$input.attr( 'required', 'required' );
this.$input.attr( 'aria-required', 'true' );
}
+ if ( config.autocomplete === false ) {
+ this.$input.attr( 'autocomplete', 'off' );
+ }
+ if ( this.multiline && config.rows ) {
+ this.$input.attr( 'rows', config.rows );
+ }
if ( this.label || config.autosize ) {
this.installParentChangeDetector();
}
if ( this.multiline && this.autosize && this.$input.val() !== this.valCache ) {
this.$clone
.val( this.$input.val() )
- .attr( 'rows', '' )
+ .attr( 'rows', this.minRows )
// Set inline height property to 0 to measure scroll height
.css( 'height', 0 );
"link": { "file": "images/icons/link.svg" },
"linkExternal": { "file": {
"ltr": "images/icons/external-link-ltr.svg",
- "rtl": "images/icons/external-link-rtl.svg"
+ "rtl": "images/icons/external-link-rtl.svg"
} },
"linkSecure": { "file": "images/icons/secure-link.svg" }
}
/*!
- * QUnit 1.17.1
+ * QUnit 1.18.0
* http://qunitjs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
- * Date: 2015-01-20T19:39Z
+ * Date: 2015-04-03T10:23Z
*/
/** Font Family and Sizes */
#qunit-tests.hidepass li.running,
#qunit-tests.hidepass li.pass {
- display: none;
+ visibility: hidden;
+ position: absolute;
+ width: 0px;
+ height: 0px;
+ padding: 0;
+ border: 0;
+ margin: 0;
}
#qunit-tests li strong {
color: #C2CCD1;
text-decoration: none;
}
+
+#qunit-tests li p a {
+ padding: 0.25em;
+ color: #6B6464;
+}
#qunit-tests li a:hover,
#qunit-tests li a:focus {
color: #000;
/*!
- * QUnit 1.17.1
+ * QUnit 1.18.0
* http://qunitjs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
- * Date: 2015-01-20T19:39Z
+ * Date: 2015-04-03T10:23Z
*/
(function( window ) {
// when enabled, all tests must call expect()
requireExpects: false,
+ // depth up-to which object will be dumped
+ maxDepth: 5,
+
// add checkboxes that are persisted in the query-string
// when enabled, the id is set to `true` as a `QUnit.config` property
urlConfig: [
// String search anywhere in moduleName+testName
config.filter = urlParams.filter;
+ if ( urlParams.maxDepth ) {
+ config.maxDepth = parseInt( urlParams.maxDepth, 10 ) === -1 ?
+ Number.POSITIVE_INFINITY :
+ urlParams.maxDepth;
+ }
+
config.testId = [];
if ( urlParams.testId ) {
// Ensure that urlParams.testId is an array
- urlParams.testId = [].concat( urlParams.testId );
+ urlParams.testId = decodeURIComponent( urlParams.testId ).split( "," );
for ( i = 0; i < urlParams.testId.length; i++ ) {
config.testId.push( urlParams.testId[ i ] );
}
// Figure out if we're running the tests from a server or not
QUnit.isLocal = location.protocol === "file:";
+
+ // Expose the current QUnit version
+ QUnit.version = "1.18.0";
}());
// Root QUnit object.
});
}
-// Doesn't support IE6 to IE9
+// Doesn't support IE6 to IE9, it will return undefined on these browsers
// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack
function extractStacktrace( e, offset ) {
offset = offset === undefined ? 4 : offset;
var stack, include, i;
- if ( e.stacktrace ) {
-
- // Opera 12.x
- return e.stacktrace.split( "\n" )[ offset + 3 ];
- } else if ( e.stack ) {
-
- // Firefox, Chrome, Safari 6+, IE10+, PhantomJS and Node
+ if ( e.stack ) {
stack = e.stack.split( "\n" );
if ( /^error$/i.test( stack[ 0 ] ) ) {
stack.shift();
}
}
return stack[ offset ];
+
+ // Support: Safari <=6 only
} else if ( e.sourceURL ) {
- // Safari < 6
// exclude useless self-reference for generated Error objects
if ( /qunit.js$/.test( e.sourceURL ) ) {
return;
}
function sourceFromStacktrace( offset ) {
- var e = new Error();
- if ( !e.stack ) {
+ var error = new Error();
+
+ // Support: Safari <=7 only, IE <=10 - 11 only
+ // Not all browsers generate the `stack` property for `new Error()`, see also #636
+ if ( !error.stack ) {
try {
- throw e;
+ throw error;
} catch ( err ) {
- // This should already be true in most browsers
- e = err;
+ error = err;
}
}
- return extractStacktrace( e, offset );
+
+ return extractStacktrace( error, offset );
}
function synchronize( callback, last ) {
valid: function() {
var include,
- filter = config.filter,
+ filter = config.filter && config.filter.toLowerCase(),
module = QUnit.urlParams.module && QUnit.urlParams.module.toLowerCase(),
fullName = ( this.module.name + ": " + this.testName ).toLowerCase();
include = filter.charAt( 0 ) !== "!";
if ( !include ) {
- filter = filter.toLowerCase().slice( 1 );
+ filter = filter.slice( 1 );
}
// If the filter matches, we need to honour include
return assert.test.push.apply( assert.test, arguments );
},
- /**
- * Asserts rough true-ish result.
- * @name ok
- * @function
- * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
- */
ok: function( result, message ) {
message = message || ( result ? "okay" : "failed, expected argument to be truthy, was: " +
QUnit.dump.parse( result ) );
this.push( !!result, result, true, message );
},
- /**
- * Assert that the first two arguments are equal, with an optional message.
- * Prints out both actual and expected values.
- * @name equal
- * @function
- * @example equal( format( "{0} bytes.", 2), "2 bytes.", "replaces {0} with next argument" );
- */
+ notOk: function( result, message ) {
+ message = message || ( !result ? "okay" : "failed, expected argument to be falsy, was: " +
+ QUnit.dump.parse( result ) );
+ this.push( !result, result, false, message );
+ },
+
equal: function( actual, expected, message ) {
/*jshint eqeqeq:false */
this.push( expected == actual, actual, expected, message );
},
- /**
- * @name notEqual
- * @function
- */
notEqual: function( actual, expected, message ) {
/*jshint eqeqeq:false */
this.push( expected != actual, actual, expected, message );
},
- /**
- * @name propEqual
- * @function
- */
propEqual: function( actual, expected, message ) {
actual = objectValues( actual );
expected = objectValues( expected );
this.push( QUnit.equiv( actual, expected ), actual, expected, message );
},
- /**
- * @name notPropEqual
- * @function
- */
notPropEqual: function( actual, expected, message ) {
actual = objectValues( actual );
expected = objectValues( expected );
this.push( !QUnit.equiv( actual, expected ), actual, expected, message );
},
- /**
- * @name deepEqual
- * @function
- */
deepEqual: function( actual, expected, message ) {
this.push( QUnit.equiv( actual, expected ), actual, expected, message );
},
- /**
- * @name notDeepEqual
- * @function
- */
notDeepEqual: function( actual, expected, message ) {
this.push( !QUnit.equiv( actual, expected ), actual, expected, message );
},
- /**
- * @name strictEqual
- * @function
- */
strictEqual: function( actual, expected, message ) {
this.push( expected === actual, actual, expected, message );
},
- /**
- * @name notStrictEqual
- * @function
- */
notStrictEqual: function( actual, expected, message ) {
this.push( expected !== actual, actual, expected, message );
},
"throws": function( block, expected, message ) {
var actual, expectedType,
expectedOutput = expected,
- ok = false;
+ ok = false,
+ currentTest = ( this instanceof Assert && this.test ) || QUnit.config.current;
// 'expected' is optional unless doing string comparison
if ( message == null && typeof expected === "string" ) {
expected = null;
}
- this.test.ignoreGlobalErrors = true;
+ currentTest.ignoreGlobalErrors = true;
try {
- block.call( this.test.testEnvironment );
+ block.call( currentTest.testEnvironment );
} catch (e) {
actual = e;
}
- this.test.ignoreGlobalErrors = false;
+ currentTest.ignoreGlobalErrors = false;
if ( actual ) {
expectedType = QUnit.objectType( expected );
expectedOutput = null;
ok = true;
}
-
- this.push( ok, actual, expectedOutput, message );
- } else {
- this.test.pushFailure( message, null, "No exception was thrown." );
}
+
+ currentTest.assert.push( ok, actual, expectedOutput, message );
}
};
join: join,
//
depth: 1,
- maxDepth: 5,
+ maxDepth: QUnit.config.maxDepth,
// This is the list of parsers, to modify them, use dump.setParser
parsers: {
nonEnumerableProperties = [ "message", "name" ];
for ( i in nonEnumerableProperties ) {
key = nonEnumerableProperties[ i ];
- if ( key in map && !( key in keys ) ) {
+ if ( key in map && inArray( key, keys ) < 0 ) {
keys.push( key );
}
}
"start",
"stop",
"ok",
+ "notOk",
"equal",
"notEqual",
"propEqual",
exports.QUnit = QUnit;
}
+if ( typeof define === "function" && define.amd ) {
+ define( function() {
+ return QUnit;
+ } );
+ QUnit.config.autostart = false;
+}
+
// Get a reference to the global object, like window in browsers
}( (function() {
return this;
/*istanbul ignore next */
// jscs:disable maximumLineLength
/*
- * Javascript Diff Algorithm
- * By John Resig (http://ejohn.org/)
- * Modified by Chu Alan "sprite"
+ * This file is a modified version of google-diff-match-patch's JavaScript implementation
+ * (https://code.google.com/p/google-diff-match-patch/source/browse/trunk/javascript/diff_match_patch_uncompressed.js),
+ * modifications are licensed as more fully set forth in LICENSE.txt.
+ *
+ * The original source of google-diff-match-patch is attributable and licensed as follows:
*
- * Released under the MIT license.
+ * Copyright 2006 Google Inc.
+ * http://code.google.com/p/google-diff-match-patch/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* More Info:
- * http://ejohn.org/projects/javascript-diff-algorithm/
+ * https://code.google.com/p/google-diff-match-patch/
*
* Usage: QUnit.diff(expected, actual)
*
- * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
+ * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) === "the quick <del>brown </del> fox jump<ins>s</ins><del>ed</del over"
*/
QUnit.diff = (function() {
- var hasOwn = Object.prototype.hasOwnProperty;
-
- /*jshint eqeqeq:false, eqnull:true */
- function diff( o, n ) {
- var i,
- ns = {},
- os = {};
-
- for ( i = 0; i < n.length; i++ ) {
- if ( !hasOwn.call( ns, n[ i ] ) ) {
- ns[ n[ i ] ] = {
- rows: [],
- o: null
- };
- }
- ns[ n[ i ] ].rows.push( i );
- }
-
- for ( i = 0; i < o.length; i++ ) {
- if ( !hasOwn.call( os, o[ i ] ) ) {
- os[ o[ i ] ] = {
- rows: [],
- n: null
- };
- }
- os[ o[ i ] ].rows.push( i );
- }
-
- for ( i in ns ) {
- if ( hasOwn.call( ns, i ) ) {
- if ( ns[ i ].rows.length === 1 && hasOwn.call( os, i ) && os[ i ].rows.length === 1 ) {
- n[ ns[ i ].rows[ 0 ] ] = {
- text: n[ ns[ i ].rows[ 0 ] ],
- row: os[ i ].rows[ 0 ]
- };
- o[ os[ i ].rows[ 0 ] ] = {
- text: o[ os[ i ].rows[ 0 ] ],
- row: ns[ i ].rows[ 0 ]
- };
- }
- }
- }
- for ( i = 0; i < n.length - 1; i++ ) {
- if ( n[ i ].text != null && n[ i + 1 ].text == null && n[ i ].row + 1 < o.length && o[ n[ i ].row + 1 ].text == null &&
- n[ i + 1 ] == o[ n[ i ].row + 1 ] ) {
-
- n[ i + 1 ] = {
- text: n[ i + 1 ],
- row: n[ i ].row + 1
- };
- o[ n[ i ].row + 1 ] = {
- text: o[ n[ i ].row + 1 ],
- row: i + 1
- };
- }
- }
-
- for ( i = n.length - 1; i > 0; i-- ) {
- if ( n[ i ].text != null && n[ i - 1 ].text == null && n[ i ].row > 0 && o[ n[ i ].row - 1 ].text == null &&
- n[ i - 1 ] == o[ n[ i ].row - 1 ] ) {
-
- n[ i - 1 ] = {
- text: n[ i - 1 ],
- row: n[ i ].row - 1
- };
- o[ n[ i ].row - 1 ] = {
- text: o[ n[ i ].row - 1 ],
- row: i - 1
- };
- }
- }
-
- return {
- o: o,
- n: n
- };
- }
-
- return function( o, n ) {
- o = o.replace( /\s+$/, "" );
- n = n.replace( /\s+$/, "" );
-
- var i, pre,
- str = "",
- out = diff( o === "" ? [] : o.split( /\s+/ ), n === "" ? [] : n.split( /\s+/ ) ),
- oSpace = o.match( /\s+/g ),
- nSpace = n.match( /\s+/g );
-
- if ( oSpace == null ) {
- oSpace = [ " " ];
- } else {
- oSpace.push( " " );
- }
-
- if ( nSpace == null ) {
- nSpace = [ " " ];
- } else {
- nSpace.push( " " );
- }
-
- if ( out.n.length === 0 ) {
- for ( i = 0; i < out.o.length; i++ ) {
- str += "<del>" + out.o[ i ] + oSpace[ i ] + "</del>";
- }
- } else {
- if ( out.n[ 0 ].text == null ) {
- for ( n = 0; n < out.o.length && out.o[ n ].text == null; n++ ) {
- str += "<del>" + out.o[ n ] + oSpace[ n ] + "</del>";
- }
- }
-
- for ( i = 0; i < out.n.length; i++ ) {
- if ( out.n[ i ].text == null ) {
- str += "<ins>" + out.n[ i ] + nSpace[ i ] + "</ins>";
- } else {
-
- // `pre` initialized at top of scope
- pre = "";
-
- for ( n = out.n[ i ].row + 1; n < out.o.length && out.o[ n ].text == null; n++ ) {
- pre += "<del>" + out.o[ n ] + oSpace[ n ] + "</del>";
- }
- str += " " + out.n[ i ].text + nSpace[ i ] + pre;
- }
- }
- }
-
- return str;
- };
+ function DiffMatchPatch() {
+
+ // Defaults.
+ // Redefine these in your program to override the defaults.
+
+ // Number of seconds to map a diff before giving up (0 for infinity).
+ this.DiffTimeout = 1.0;
+ // Cost of an empty edit operation in terms of edit characters.
+ this.DiffEditCost = 4;
+ }
+
+ // DIFF FUNCTIONS
+
+ /**
+ * The data structure representing a diff is an array of tuples:
+ * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
+ * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
+ */
+ var DIFF_DELETE = -1,
+ DIFF_INSERT = 1,
+ DIFF_EQUAL = 0;
+
+ /**
+ * Find the differences between two texts. Simplifies the problem by stripping
+ * any common prefix or suffix off the texts before diffing.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {boolean=} optChecklines Optional speedup flag. If present and false,
+ * then don't run a line-level diff first to identify the changed areas.
+ * Defaults to true, which does a faster, slightly less optimal diff.
+ * @param {number} optDeadline Optional time when the diff should be complete
+ * by. Used internally for recursive calls. Users should set DiffTimeout
+ * instead.
+ * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.
+ */
+ DiffMatchPatch.prototype.DiffMain = function( text1, text2, optChecklines, optDeadline ) {
+ var deadline, checklines, commonlength,
+ commonprefix, commonsuffix, diffs;
+ // Set a deadline by which time the diff must be complete.
+ if ( typeof optDeadline === "undefined" ) {
+ if ( this.DiffTimeout <= 0 ) {
+ optDeadline = Number.MAX_VALUE;
+ } else {
+ optDeadline = ( new Date() ).getTime() + this.DiffTimeout * 1000;
+ }
+ }
+ deadline = optDeadline;
+
+ // Check for null inputs.
+ if ( text1 === null || text2 === null ) {
+ throw new Error( "Null input. (DiffMain)" );
+ }
+
+ // Check for equality (speedup).
+ if ( text1 === text2 ) {
+ if ( text1 ) {
+ return [
+ [ DIFF_EQUAL, text1 ]
+ ];
+ }
+ return [];
+ }
+
+ if ( typeof optChecklines === "undefined" ) {
+ optChecklines = true;
+ }
+
+ checklines = optChecklines;
+
+ // Trim off common prefix (speedup).
+ commonlength = this.diffCommonPrefix( text1, text2 );
+ commonprefix = text1.substring( 0, commonlength );
+ text1 = text1.substring( commonlength );
+ text2 = text2.substring( commonlength );
+
+ // Trim off common suffix (speedup).
+ /////////
+ commonlength = this.diffCommonSuffix( text1, text2 );
+ commonsuffix = text1.substring( text1.length - commonlength );
+ text1 = text1.substring( 0, text1.length - commonlength );
+ text2 = text2.substring( 0, text2.length - commonlength );
+
+ // Compute the diff on the middle block.
+ diffs = this.diffCompute( text1, text2, checklines, deadline );
+
+ // Restore the prefix and suffix.
+ if ( commonprefix ) {
+ diffs.unshift( [ DIFF_EQUAL, commonprefix ] );
+ }
+ if ( commonsuffix ) {
+ diffs.push( [ DIFF_EQUAL, commonsuffix ] );
+ }
+ this.diffCleanupMerge( diffs );
+ return diffs;
+ };
+
+ /**
+ * Reduce the number of edits by eliminating operationally trivial equalities.
+ * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.
+ */
+ DiffMatchPatch.prototype.diffCleanupEfficiency = function( diffs ) {
+ var changes, equalities, equalitiesLength, lastequality,
+ pointer, preIns, preDel, postIns, postDel;
+ changes = false;
+ equalities = []; // Stack of indices where equalities are found.
+ equalitiesLength = 0; // Keeping our own length var is faster in JS.
+ /** @type {?string} */
+ lastequality = null;
+ // Always equal to diffs[equalities[equalitiesLength - 1]][1]
+ pointer = 0; // Index of current position.
+ // Is there an insertion operation before the last equality.
+ preIns = false;
+ // Is there a deletion operation before the last equality.
+ preDel = false;
+ // Is there an insertion operation after the last equality.
+ postIns = false;
+ // Is there a deletion operation after the last equality.
+ postDel = false;
+ while ( pointer < diffs.length ) {
+ if ( diffs[ pointer ][ 0 ] === DIFF_EQUAL ) { // Equality found.
+ if ( diffs[ pointer ][ 1 ].length < this.DiffEditCost && ( postIns || postDel ) ) {
+ // Candidate found.
+ equalities[ equalitiesLength++ ] = pointer;
+ preIns = postIns;
+ preDel = postDel;
+ lastequality = diffs[ pointer ][ 1 ];
+ } else {
+ // Not a candidate, and can never become one.
+ equalitiesLength = 0;
+ lastequality = null;
+ }
+ postIns = postDel = false;
+ } else { // An insertion or deletion.
+ if ( diffs[ pointer ][ 0 ] === DIFF_DELETE ) {
+ postDel = true;
+ } else {
+ postIns = true;
+ }
+ /*
+ * Five types to be split:
+ * <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>
+ * <ins>A</ins>X<ins>C</ins><del>D</del>
+ * <ins>A</ins><del>B</del>X<ins>C</ins>
+ * <ins>A</del>X<ins>C</ins><del>D</del>
+ * <ins>A</ins><del>B</del>X<del>C</del>
+ */
+ if ( lastequality && ( ( preIns && preDel && postIns && postDel ) ||
+ ( ( lastequality.length < this.DiffEditCost / 2 ) &&
+ ( preIns + preDel + postIns + postDel ) === 3 ) ) ) {
+ // Duplicate record.
+ diffs.splice( equalities[equalitiesLength - 1], 0, [ DIFF_DELETE, lastequality ] );
+ // Change second copy to insert.
+ diffs[ equalities[ equalitiesLength - 1 ] + 1 ][ 0 ] = DIFF_INSERT;
+ equalitiesLength--; // Throw away the equality we just deleted;
+ lastequality = null;
+ if (preIns && preDel) {
+ // No changes made which could affect previous entry, keep going.
+ postIns = postDel = true;
+ equalitiesLength = 0;
+ } else {
+ equalitiesLength--; // Throw away the previous equality.
+ pointer = equalitiesLength > 0 ? equalities[ equalitiesLength - 1 ] : -1;
+ postIns = postDel = false;
+ }
+ changes = true;
+ }
+ }
+ pointer++;
+ }
+
+ if ( changes ) {
+ this.diffCleanupMerge( diffs );
+ }
+ };
+
+ /**
+ * Convert a diff array into a pretty HTML report.
+ * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.
+ * @param {integer} string to be beautified.
+ * @return {string} HTML representation.
+ */
+ DiffMatchPatch.prototype.diffPrettyHtml = function( diffs ) {
+ var op, data, x, html = [];
+ for ( x = 0; x < diffs.length; x++ ) {
+ op = diffs[x][0]; // Operation (insert, delete, equal)
+ data = diffs[x][1]; // Text of change.
+ switch ( op ) {
+ case DIFF_INSERT:
+ html[x] = "<ins>" + data + "</ins>";
+ break;
+ case DIFF_DELETE:
+ html[x] = "<del>" + data + "</del>";
+ break;
+ case DIFF_EQUAL:
+ html[x] = "<span>" + data + "</span>";
+ break;
+ }
+ }
+ return html.join("");
+ };
+
+ /**
+ * Determine the common prefix of two strings.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {number} The number of characters common to the start of each
+ * string.
+ */
+ DiffMatchPatch.prototype.diffCommonPrefix = function( text1, text2 ) {
+ var pointermid, pointermax, pointermin, pointerstart;
+ // Quick check for common null cases.
+ if ( !text1 || !text2 || text1.charAt(0) !== text2.charAt(0) ) {
+ return 0;
+ }
+ // Binary search.
+ // Performance analysis: http://neil.fraser.name/news/2007/10/09/
+ pointermin = 0;
+ pointermax = Math.min( text1.length, text2.length );
+ pointermid = pointermax;
+ pointerstart = 0;
+ while ( pointermin < pointermid ) {
+ if ( text1.substring( pointerstart, pointermid ) === text2.substring( pointerstart, pointermid ) ) {
+ pointermin = pointermid;
+ pointerstart = pointermin;
+ } else {
+ pointermax = pointermid;
+ }
+ pointermid = Math.floor( ( pointermax - pointermin ) / 2 + pointermin );
+ }
+ return pointermid;
+ };
+
+ /**
+ * Determine the common suffix of two strings.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {number} The number of characters common to the end of each string.
+ */
+ DiffMatchPatch.prototype.diffCommonSuffix = function( text1, text2 ) {
+ var pointermid, pointermax, pointermin, pointerend;
+ // Quick check for common null cases.
+ if (!text1 || !text2 || text1.charAt(text1.length - 1) !== text2.charAt(text2.length - 1)) {
+ return 0;
+ }
+ // Binary search.
+ // Performance analysis: http://neil.fraser.name/news/2007/10/09/
+ pointermin = 0;
+ pointermax = Math.min(text1.length, text2.length);
+ pointermid = pointermax;
+ pointerend = 0;
+ while ( pointermin < pointermid ) {
+ if (text1.substring( text1.length - pointermid, text1.length - pointerend ) ===
+ text2.substring( text2.length - pointermid, text2.length - pointerend ) ) {
+ pointermin = pointermid;
+ pointerend = pointermin;
+ } else {
+ pointermax = pointermid;
+ }
+ pointermid = Math.floor( ( pointermax - pointermin ) / 2 + pointermin );
+ }
+ return pointermid;
+ };
+
+ /**
+ * Find the differences between two texts. Assumes that the texts do not
+ * have any common prefix or suffix.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {boolean} checklines Speedup flag. If false, then don't run a
+ * line-level diff first to identify the changed areas.
+ * If true, then run a faster, slightly less optimal diff.
+ * @param {number} deadline Time when the diff should be complete by.
+ * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffCompute = function( text1, text2, checklines, deadline ) {
+ var diffs, longtext, shorttext, i, hm,
+ text1A, text2A, text1B, text2B,
+ midCommon, diffsA, diffsB;
+
+ if ( !text1 ) {
+ // Just add some text (speedup).
+ return [
+ [ DIFF_INSERT, text2 ]
+ ];
+ }
+
+ if (!text2) {
+ // Just delete some text (speedup).
+ return [
+ [ DIFF_DELETE, text1 ]
+ ];
+ }
+
+ longtext = text1.length > text2.length ? text1 : text2;
+ shorttext = text1.length > text2.length ? text2 : text1;
+ i = longtext.indexOf( shorttext );
+ if ( i !== -1 ) {
+ // Shorter text is inside the longer text (speedup).
+ diffs = [
+ [ DIFF_INSERT, longtext.substring( 0, i ) ],
+ [ DIFF_EQUAL, shorttext ],
+ [ DIFF_INSERT, longtext.substring( i + shorttext.length ) ]
+ ];
+ // Swap insertions for deletions if diff is reversed.
+ if ( text1.length > text2.length ) {
+ diffs[0][0] = diffs[2][0] = DIFF_DELETE;
+ }
+ return diffs;
+ }
+
+ if ( shorttext.length === 1 ) {
+ // Single character string.
+ // After the previous speedup, the character can't be an equality.
+ return [
+ [ DIFF_DELETE, text1 ],
+ [ DIFF_INSERT, text2 ]
+ ];
+ }
+
+ // Check to see if the problem can be split in two.
+ hm = this.diffHalfMatch(text1, text2);
+ if (hm) {
+ // A half-match was found, sort out the return data.
+ text1A = hm[0];
+ text1B = hm[1];
+ text2A = hm[2];
+ text2B = hm[3];
+ midCommon = hm[4];
+ // Send both pairs off for separate processing.
+ diffsA = this.DiffMain(text1A, text2A, checklines, deadline);
+ diffsB = this.DiffMain(text1B, text2B, checklines, deadline);
+ // Merge the results.
+ return diffsA.concat([
+ [ DIFF_EQUAL, midCommon ]
+ ], diffsB);
+ }
+
+ if (checklines && text1.length > 100 && text2.length > 100) {
+ return this.diffLineMode(text1, text2, deadline);
+ }
+
+ return this.diffBisect(text1, text2, deadline);
+ };
+
+ /**
+ * Do the two texts share a substring which is at least half the length of the
+ * longer text?
+ * This speedup can produce non-minimal diffs.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {Array.<string>} Five element Array, containing the prefix of
+ * text1, the suffix of text1, the prefix of text2, the suffix of
+ * text2 and the common middle. Or null if there was no match.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffHalfMatch = function(text1, text2) {
+ var longtext, shorttext, dmp,
+ text1A, text2B, text2A, text1B, midCommon,
+ hm1, hm2, hm;
+ if (this.DiffTimeout <= 0) {
+ // Don't risk returning a non-optimal diff if we have unlimited time.
+ return null;
+ }
+ longtext = text1.length > text2.length ? text1 : text2;
+ shorttext = text1.length > text2.length ? text2 : text1;
+ if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
+ return null; // Pointless.
+ }
+ dmp = this; // 'this' becomes 'window' in a closure.
+
+ /**
+ * Does a substring of shorttext exist within longtext such that the substring
+ * is at least half the length of longtext?
+ * Closure, but does not reference any external variables.
+ * @param {string} longtext Longer string.
+ * @param {string} shorttext Shorter string.
+ * @param {number} i Start index of quarter length substring within longtext.
+ * @return {Array.<string>} Five element Array, containing the prefix of
+ * longtext, the suffix of longtext, the prefix of shorttext, the suffix
+ * of shorttext and the common middle. Or null if there was no match.
+ * @private
+ */
+ function diffHalfMatchI(longtext, shorttext, i) {
+ var seed, j, bestCommon, prefixLength, suffixLength,
+ bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB;
+ // Start with a 1/4 length substring at position i as a seed.
+ seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
+ j = -1;
+ bestCommon = "";
+ while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {
+ prefixLength = dmp.diffCommonPrefix(longtext.substring(i),
+ shorttext.substring(j));
+ suffixLength = dmp.diffCommonSuffix(longtext.substring(0, i),
+ shorttext.substring(0, j));
+ if (bestCommon.length < suffixLength + prefixLength) {
+ bestCommon = shorttext.substring(j - suffixLength, j) +
+ shorttext.substring(j, j + prefixLength);
+ bestLongtextA = longtext.substring(0, i - suffixLength);
+ bestLongtextB = longtext.substring(i + prefixLength);
+ bestShorttextA = shorttext.substring(0, j - suffixLength);
+ bestShorttextB = shorttext.substring(j + prefixLength);
+ }
+ }
+ if (bestCommon.length * 2 >= longtext.length) {
+ return [ bestLongtextA, bestLongtextB,
+ bestShorttextA, bestShorttextB, bestCommon
+ ];
+ } else {
+ return null;
+ }
+ }
+
+ // First check if the second quarter is the seed for a half-match.
+ hm1 = diffHalfMatchI(longtext, shorttext,
+ Math.ceil(longtext.length / 4));
+ // Check again based on the third quarter.
+ hm2 = diffHalfMatchI(longtext, shorttext,
+ Math.ceil(longtext.length / 2));
+ if (!hm1 && !hm2) {
+ return null;
+ } else if (!hm2) {
+ hm = hm1;
+ } else if (!hm1) {
+ hm = hm2;
+ } else {
+ // Both matched. Select the longest.
+ hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
+ }
+
+ // A half-match was found, sort out the return data.
+ text1A, text1B, text2A, text2B;
+ if (text1.length > text2.length) {
+ text1A = hm[0];
+ text1B = hm[1];
+ text2A = hm[2];
+ text2B = hm[3];
+ } else {
+ text2A = hm[0];
+ text2B = hm[1];
+ text1A = hm[2];
+ text1B = hm[3];
+ }
+ midCommon = hm[4];
+ return [ text1A, text1B, text2A, text2B, midCommon ];
+ };
+
+ /**
+ * Do a quick line-level diff on both strings, then rediff the parts for
+ * greater accuracy.
+ * This speedup can produce non-minimal diffs.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {number} deadline Time when the diff should be complete by.
+ * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffLineMode = function(text1, text2, deadline) {
+ var a, diffs, linearray, pointer, countInsert,
+ countDelete, textInsert, textDelete, j;
+ // Scan the text on a line-by-line basis first.
+ a = this.diffLinesToChars(text1, text2);
+ text1 = a.chars1;
+ text2 = a.chars2;
+ linearray = a.lineArray;
+
+ diffs = this.DiffMain(text1, text2, false, deadline);
+
+ // Convert the diff back to original text.
+ this.diffCharsToLines(diffs, linearray);
+ // Eliminate freak matches (e.g. blank lines)
+ this.diffCleanupSemantic(diffs);
+
+ // Rediff any replacement blocks, this time character-by-character.
+ // Add a dummy entry at the end.
+ diffs.push( [ DIFF_EQUAL, "" ] );
+ pointer = 0;
+ countDelete = 0;
+ countInsert = 0;
+ textDelete = "";
+ textInsert = "";
+ while (pointer < diffs.length) {
+ switch ( diffs[pointer][0] ) {
+ case DIFF_INSERT:
+ countInsert++;
+ textInsert += diffs[pointer][1];
+ break;
+ case DIFF_DELETE:
+ countDelete++;
+ textDelete += diffs[pointer][1];
+ break;
+ case DIFF_EQUAL:
+ // Upon reaching an equality, check for prior redundancies.
+ if (countDelete >= 1 && countInsert >= 1) {
+ // Delete the offending records and add the merged ones.
+ diffs.splice(pointer - countDelete - countInsert,
+ countDelete + countInsert);
+ pointer = pointer - countDelete - countInsert;
+ a = this.DiffMain(textDelete, textInsert, false, deadline);
+ for (j = a.length - 1; j >= 0; j--) {
+ diffs.splice( pointer, 0, a[j] );
+ }
+ pointer = pointer + a.length;
+ }
+ countInsert = 0;
+ countDelete = 0;
+ textDelete = "";
+ textInsert = "";
+ break;
+ }
+ pointer++;
+ }
+ diffs.pop(); // Remove the dummy entry at the end.
+
+ return diffs;
+ };
+
+ /**
+ * Find the 'middle snake' of a diff, split the problem in two
+ * and return the recursively constructed diff.
+ * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {number} deadline Time at which to bail if not yet complete.
+ * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffBisect = function(text1, text2, deadline) {
+ var text1Length, text2Length, maxD, vOffset, vLength,
+ v1, v2, x, delta, front, k1start, k1end, k2start,
+ k2end, k2Offset, k1Offset, x1, x2, y1, y2, d, k1, k2;
+ // Cache the text lengths to prevent multiple calls.
+ text1Length = text1.length;
+ text2Length = text2.length;
+ maxD = Math.ceil((text1Length + text2Length) / 2);
+ vOffset = maxD;
+ vLength = 2 * maxD;
+ v1 = new Array(vLength);
+ v2 = new Array(vLength);
+ // Setting all elements to -1 is faster in Chrome & Firefox than mixing
+ // integers and undefined.
+ for (x = 0; x < vLength; x++) {
+ v1[x] = -1;
+ v2[x] = -1;
+ }
+ v1[vOffset + 1] = 0;
+ v2[vOffset + 1] = 0;
+ delta = text1Length - text2Length;
+ // If the total number of characters is odd, then the front path will collide
+ // with the reverse path.
+ front = (delta % 2 !== 0);
+ // Offsets for start and end of k loop.
+ // Prevents mapping of space beyond the grid.
+ k1start = 0;
+ k1end = 0;
+ k2start = 0;
+ k2end = 0;
+ for (d = 0; d < maxD; d++) {
+ // Bail out if deadline is reached.
+ if ((new Date()).getTime() > deadline) {
+ break;
+ }
+
+ // Walk the front path one step.
+ for (k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
+ k1Offset = vOffset + k1;
+ if ( k1 === -d || ( k1 !== d && v1[ k1Offset - 1 ] < v1[ k1Offset + 1 ] ) ) {
+ x1 = v1[k1Offset + 1];
+ } else {
+ x1 = v1[k1Offset - 1] + 1;
+ }
+ y1 = x1 - k1;
+ while (x1 < text1Length && y1 < text2Length &&
+ text1.charAt(x1) === text2.charAt(y1)) {
+ x1++;
+ y1++;
+ }
+ v1[k1Offset] = x1;
+ if (x1 > text1Length) {
+ // Ran off the right of the graph.
+ k1end += 2;
+ } else if (y1 > text2Length) {
+ // Ran off the bottom of the graph.
+ k1start += 2;
+ } else if (front) {
+ k2Offset = vOffset + delta - k1;
+ if (k2Offset >= 0 && k2Offset < vLength && v2[k2Offset] !== -1) {
+ // Mirror x2 onto top-left coordinate system.
+ x2 = text1Length - v2[k2Offset];
+ if (x1 >= x2) {
+ // Overlap detected.
+ return this.diffBisectSplit(text1, text2, x1, y1, deadline);
+ }
+ }
+ }
+ }
+
+ // Walk the reverse path one step.
+ for (k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
+ k2Offset = vOffset + k2;
+ if ( k2 === -d || (k2 !== d && v2[ k2Offset - 1 ] < v2[ k2Offset + 1 ] ) ) {
+ x2 = v2[k2Offset + 1];
+ } else {
+ x2 = v2[k2Offset - 1] + 1;
+ }
+ y2 = x2 - k2;
+ while (x2 < text1Length && y2 < text2Length &&
+ text1.charAt(text1Length - x2 - 1) ===
+ text2.charAt(text2Length - y2 - 1)) {
+ x2++;
+ y2++;
+ }
+ v2[k2Offset] = x2;
+ if (x2 > text1Length) {
+ // Ran off the left of the graph.
+ k2end += 2;
+ } else if (y2 > text2Length) {
+ // Ran off the top of the graph.
+ k2start += 2;
+ } else if (!front) {
+ k1Offset = vOffset + delta - k2;
+ if (k1Offset >= 0 && k1Offset < vLength && v1[k1Offset] !== -1) {
+ x1 = v1[k1Offset];
+ y1 = vOffset + x1 - k1Offset;
+ // Mirror x2 onto top-left coordinate system.
+ x2 = text1Length - x2;
+ if (x1 >= x2) {
+ // Overlap detected.
+ return this.diffBisectSplit(text1, text2, x1, y1, deadline);
+ }
+ }
+ }
+ }
+ }
+ // Diff took too long and hit the deadline or
+ // number of diffs equals number of characters, no commonality at all.
+ return [
+ [ DIFF_DELETE, text1 ],
+ [ DIFF_INSERT, text2 ]
+ ];
+ };
+
+ /**
+ * Given the location of the 'middle snake', split the diff in two parts
+ * and recurse.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {number} x Index of split point in text1.
+ * @param {number} y Index of split point in text2.
+ * @param {number} deadline Time at which to bail if not yet complete.
+ * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffBisectSplit = function( text1, text2, x, y, deadline ) {
+ var text1a, text1b, text2a, text2b, diffs, diffsb;
+ text1a = text1.substring(0, x);
+ text2a = text2.substring(0, y);
+ text1b = text1.substring(x);
+ text2b = text2.substring(y);
+
+ // Compute both diffs serially.
+ diffs = this.DiffMain(text1a, text2a, false, deadline);
+ diffsb = this.DiffMain(text1b, text2b, false, deadline);
+
+ return diffs.concat(diffsb);
+ };
+
+ /**
+ * Reduce the number of edits by eliminating semantically trivial equalities.
+ * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.
+ */
+ DiffMatchPatch.prototype.diffCleanupSemantic = function(diffs) {
+ var changes, equalities, equalitiesLength, lastequality,
+ pointer, lengthInsertions2, lengthDeletions2, lengthInsertions1,
+ lengthDeletions1, deletion, insertion, overlapLength1, overlapLength2;
+ changes = false;
+ equalities = []; // Stack of indices where equalities are found.
+ equalitiesLength = 0; // Keeping our own length var is faster in JS.
+ /** @type {?string} */
+ lastequality = null;
+ // Always equal to diffs[equalities[equalitiesLength - 1]][1]
+ pointer = 0; // Index of current position.
+ // Number of characters that changed prior to the equality.
+ lengthInsertions1 = 0;
+ lengthDeletions1 = 0;
+ // Number of characters that changed after the equality.
+ lengthInsertions2 = 0;
+ lengthDeletions2 = 0;
+ while (pointer < diffs.length) {
+ if (diffs[pointer][0] === DIFF_EQUAL) { // Equality found.
+ equalities[equalitiesLength++] = pointer;
+ lengthInsertions1 = lengthInsertions2;
+ lengthDeletions1 = lengthDeletions2;
+ lengthInsertions2 = 0;
+ lengthDeletions2 = 0;
+ lastequality = diffs[pointer][1];
+ } else { // An insertion or deletion.
+ if (diffs[pointer][0] === DIFF_INSERT) {
+ lengthInsertions2 += diffs[pointer][1].length;
+ } else {
+ lengthDeletions2 += diffs[pointer][1].length;
+ }
+ // Eliminate an equality that is smaller or equal to the edits on both
+ // sides of it.
+ if (lastequality && (lastequality.length <=
+ Math.max(lengthInsertions1, lengthDeletions1)) &&
+ (lastequality.length <= Math.max(lengthInsertions2,
+ lengthDeletions2))) {
+ // Duplicate record.
+ diffs.splice( equalities[ equalitiesLength - 1 ], 0, [ DIFF_DELETE, lastequality ] );
+ // Change second copy to insert.
+ diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
+ // Throw away the equality we just deleted.
+ equalitiesLength--;
+ // Throw away the previous equality (it needs to be reevaluated).
+ equalitiesLength--;
+ pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
+ lengthInsertions1 = 0; // Reset the counters.
+ lengthDeletions1 = 0;
+ lengthInsertions2 = 0;
+ lengthDeletions2 = 0;
+ lastequality = null;
+ changes = true;
+ }
+ }
+ pointer++;
+ }
+
+ // Normalize the diff.
+ if (changes) {
+ this.diffCleanupMerge(diffs);
+ }
+
+ // Find any overlaps between deletions and insertions.
+ // e.g: <del>abcxxx</del><ins>xxxdef</ins>
+ // -> <del>abc</del>xxx<ins>def</ins>
+ // e.g: <del>xxxabc</del><ins>defxxx</ins>
+ // -> <ins>def</ins>xxx<del>abc</del>
+ // Only extract an overlap if it is as big as the edit ahead or behind it.
+ pointer = 1;
+ while (pointer < diffs.length) {
+ if (diffs[pointer - 1][0] === DIFF_DELETE &&
+ diffs[pointer][0] === DIFF_INSERT) {
+ deletion = diffs[pointer - 1][1];
+ insertion = diffs[pointer][1];
+ overlapLength1 = this.diffCommonOverlap(deletion, insertion);
+ overlapLength2 = this.diffCommonOverlap(insertion, deletion);
+ if (overlapLength1 >= overlapLength2) {
+ if (overlapLength1 >= deletion.length / 2 ||
+ overlapLength1 >= insertion.length / 2) {
+ // Overlap found. Insert an equality and trim the surrounding edits.
+ diffs.splice( pointer, 0, [ DIFF_EQUAL, insertion.substring( 0, overlapLength1 ) ] );
+ diffs[pointer - 1][1] =
+ deletion.substring(0, deletion.length - overlapLength1);
+ diffs[pointer + 1][1] = insertion.substring(overlapLength1);
+ pointer++;
+ }
+ } else {
+ if (overlapLength2 >= deletion.length / 2 ||
+ overlapLength2 >= insertion.length / 2) {
+ // Reverse overlap found.
+ // Insert an equality and swap and trim the surrounding edits.
+ diffs.splice( pointer, 0, [ DIFF_EQUAL, deletion.substring( 0, overlapLength2 ) ] );
+ diffs[pointer - 1][0] = DIFF_INSERT;
+ diffs[pointer - 1][1] =
+ insertion.substring(0, insertion.length - overlapLength2);
+ diffs[pointer + 1][0] = DIFF_DELETE;
+ diffs[pointer + 1][1] =
+ deletion.substring(overlapLength2);
+ pointer++;
+ }
+ }
+ pointer++;
+ }
+ pointer++;
+ }
+ };
+
+ /**
+ * Determine if the suffix of one string is the prefix of another.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {number} The number of characters common to the end of the first
+ * string and the start of the second string.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffCommonOverlap = function(text1, text2) {
+ var text1Length, text2Length, textLength,
+ best, length, pattern, found;
+ // Cache the text lengths to prevent multiple calls.
+ text1Length = text1.length;
+ text2Length = text2.length;
+ // Eliminate the null case.
+ if (text1Length === 0 || text2Length === 0) {
+ return 0;
+ }
+ // Truncate the longer string.
+ if (text1Length > text2Length) {
+ text1 = text1.substring(text1Length - text2Length);
+ } else if (text1Length < text2Length) {
+ text2 = text2.substring(0, text1Length);
+ }
+ textLength = Math.min(text1Length, text2Length);
+ // Quick check for the worst case.
+ if (text1 === text2) {
+ return textLength;
+ }
+
+ // Start by looking for a single character match
+ // and increase length until no match is found.
+ // Performance analysis: http://neil.fraser.name/news/2010/11/04/
+ best = 0;
+ length = 1;
+ while (true) {
+ pattern = text1.substring(textLength - length);
+ found = text2.indexOf(pattern);
+ if (found === -1) {
+ return best;
+ }
+ length += found;
+ if (found === 0 || text1.substring(textLength - length) ===
+ text2.substring(0, length)) {
+ best = length;
+ length++;
+ }
+ }
+ };
+
+ /**
+ * Split two texts into an array of strings. Reduce the texts to a string of
+ * hashes where each Unicode character represents one line.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {{chars1: string, chars2: string, lineArray: !Array.<string>}}
+ * An object containing the encoded text1, the encoded text2 and
+ * the array of unique strings.
+ * The zeroth element of the array of unique strings is intentionally blank.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffLinesToChars = function(text1, text2) {
+ var lineArray, lineHash, chars1, chars2;
+ lineArray = []; // e.g. lineArray[4] === 'Hello\n'
+ lineHash = {}; // e.g. lineHash['Hello\n'] === 4
+
+ // '\x00' is a valid character, but various debuggers don't like it.
+ // So we'll insert a junk entry to avoid generating a null character.
+ lineArray[0] = "";
+
+ /**
+ * Split a text into an array of strings. Reduce the texts to a string of
+ * hashes where each Unicode character represents one line.
+ * Modifies linearray and linehash through being a closure.
+ * @param {string} text String to encode.
+ * @return {string} Encoded string.
+ * @private
+ */
+ function diffLinesToCharsMunge(text) {
+ var chars, lineStart, lineEnd, lineArrayLength, line;
+ chars = "";
+ // Walk the text, pulling out a substring for each line.
+ // text.split('\n') would would temporarily double our memory footprint.
+ // Modifying text would create many large strings to garbage collect.
+ lineStart = 0;
+ lineEnd = -1;
+ // Keeping our own length variable is faster than looking it up.
+ lineArrayLength = lineArray.length;
+ while (lineEnd < text.length - 1) {
+ lineEnd = text.indexOf("\n", lineStart);
+ if (lineEnd === -1) {
+ lineEnd = text.length - 1;
+ }
+ line = text.substring(lineStart, lineEnd + 1);
+ lineStart = lineEnd + 1;
+
+ if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) :
+ (lineHash[line] !== undefined)) {
+ chars += String.fromCharCode( lineHash[ line ] );
+ } else {
+ chars += String.fromCharCode(lineArrayLength);
+ lineHash[line] = lineArrayLength;
+ lineArray[lineArrayLength++] = line;
+ }
+ }
+ return chars;
+ }
+
+ chars1 = diffLinesToCharsMunge(text1);
+ chars2 = diffLinesToCharsMunge(text2);
+ return {
+ chars1: chars1,
+ chars2: chars2,
+ lineArray: lineArray
+ };
+ };
+
+ /**
+ * Rehydrate the text in a diff from a string of line hashes to real lines of
+ * text.
+ * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.
+ * @param {!Array.<string>} lineArray Array of unique strings.
+ * @private
+ */
+ DiffMatchPatch.prototype.diffCharsToLines = function( diffs, lineArray ) {
+ var x, chars, text, y;
+ for ( x = 0; x < diffs.length; x++ ) {
+ chars = diffs[x][1];
+ text = [];
+ for ( y = 0; y < chars.length; y++ ) {
+ text[y] = lineArray[chars.charCodeAt(y)];
+ }
+ diffs[x][1] = text.join("");
+ }
+ };
+
+ /**
+ * Reorder and merge like edit sections. Merge equalities.
+ * Any edit section can move as long as it doesn't cross an equality.
+ * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.
+ */
+ DiffMatchPatch.prototype.diffCleanupMerge = function(diffs) {
+ var pointer, countDelete, countInsert, textInsert, textDelete,
+ commonlength, changes;
+ diffs.push( [ DIFF_EQUAL, "" ] ); // Add a dummy entry at the end.
+ pointer = 0;
+ countDelete = 0;
+ countInsert = 0;
+ textDelete = "";
+ textInsert = "";
+ commonlength;
+ while (pointer < diffs.length) {
+ switch ( diffs[ pointer ][ 0 ] ) {
+ case DIFF_INSERT:
+ countInsert++;
+ textInsert += diffs[pointer][1];
+ pointer++;
+ break;
+ case DIFF_DELETE:
+ countDelete++;
+ textDelete += diffs[pointer][1];
+ pointer++;
+ break;
+ case DIFF_EQUAL:
+ // Upon reaching an equality, check for prior redundancies.
+ if (countDelete + countInsert > 1) {
+ if (countDelete !== 0 && countInsert !== 0) {
+ // Factor out any common prefixies.
+ commonlength = this.diffCommonPrefix(textInsert, textDelete);
+ if (commonlength !== 0) {
+ if ((pointer - countDelete - countInsert) > 0 &&
+ diffs[pointer - countDelete - countInsert - 1][0] ===
+ DIFF_EQUAL) {
+ diffs[pointer - countDelete - countInsert - 1][1] +=
+ textInsert.substring(0, commonlength);
+ } else {
+ diffs.splice( 0, 0, [ DIFF_EQUAL,
+ textInsert.substring( 0, commonlength )
+ ] );
+ pointer++;
+ }
+ textInsert = textInsert.substring(commonlength);
+ textDelete = textDelete.substring(commonlength);
+ }
+ // Factor out any common suffixies.
+ commonlength = this.diffCommonSuffix(textInsert, textDelete);
+ if (commonlength !== 0) {
+ diffs[pointer][1] = textInsert.substring(textInsert.length -
+ commonlength) + diffs[pointer][1];
+ textInsert = textInsert.substring(0, textInsert.length -
+ commonlength);
+ textDelete = textDelete.substring(0, textDelete.length -
+ commonlength);
+ }
+ }
+ // Delete the offending records and add the merged ones.
+ if (countDelete === 0) {
+ diffs.splice( pointer - countInsert,
+ countDelete + countInsert, [ DIFF_INSERT, textInsert ] );
+ } else if (countInsert === 0) {
+ diffs.splice( pointer - countDelete,
+ countDelete + countInsert, [ DIFF_DELETE, textDelete ] );
+ } else {
+ diffs.splice( pointer - countDelete - countInsert,
+ countDelete + countInsert, [ DIFF_DELETE, textDelete ], [ DIFF_INSERT, textInsert ] );
+ }
+ pointer = pointer - countDelete - countInsert +
+ (countDelete ? 1 : 0) + (countInsert ? 1 : 0) + 1;
+ } else if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {
+ // Merge this equality with the previous one.
+ diffs[pointer - 1][1] += diffs[pointer][1];
+ diffs.splice(pointer, 1);
+ } else {
+ pointer++;
+ }
+ countInsert = 0;
+ countDelete = 0;
+ textDelete = "";
+ textInsert = "";
+ break;
+ }
+ }
+ if (diffs[diffs.length - 1][1] === "") {
+ diffs.pop(); // Remove the dummy entry at the end.
+ }
+
+ // Second pass: look for single edits surrounded on both sides by equalities
+ // which can be shifted sideways to eliminate an equality.
+ // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
+ changes = false;
+ pointer = 1;
+ // Intentionally ignore the first and last element (don't need checking).
+ while (pointer < diffs.length - 1) {
+ if (diffs[pointer - 1][0] === DIFF_EQUAL &&
+ diffs[pointer + 1][0] === DIFF_EQUAL) {
+ // This is a single edit surrounded by equalities.
+ if ( diffs[ pointer ][ 1 ].substring( diffs[ pointer ][ 1 ].length -
+ diffs[ pointer - 1 ][ 1 ].length ) === diffs[ pointer - 1 ][ 1 ] ) {
+ // Shift the edit over the previous equality.
+ diffs[pointer][1] = diffs[pointer - 1][1] +
+ diffs[pointer][1].substring(0, diffs[pointer][1].length -
+ diffs[pointer - 1][1].length);
+ diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
+ diffs.splice(pointer - 1, 1);
+ changes = true;
+ } else if ( diffs[ pointer ][ 1 ].substring( 0, diffs[ pointer + 1 ][ 1 ].length ) ===
+ diffs[ pointer + 1 ][ 1 ] ) {
+ // Shift the edit over the next equality.
+ diffs[pointer - 1][1] += diffs[pointer + 1][1];
+ diffs[pointer][1] =
+ diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
+ diffs[pointer + 1][1];
+ diffs.splice(pointer + 1, 1);
+ changes = true;
+ }
+ }
+ pointer++;
+ }
+ // If shifts were made, the diff needs reordering and another shift sweep.
+ if (changes) {
+ this.diffCleanupMerge(diffs);
+ }
+ };
+
+ return function(o, n) {
+ var diff, output, text;
+ diff = new DiffMatchPatch();
+ output = diff.DiffMain(o, n);
+ //console.log(output);
+ diff.diffCleanupEfficiency(output);
+ text = diff.diffPrettyHtml(output);
+
+ return text;
+ };
}());
// jscs:enable
} else if ( elem.attachEvent ) {
// support: IE <9
- elem.attachEvent( "on" + type, fn );
+ elem.attachEvent( "on" + type, function() {
+ var event = window.event;
+ if ( !event.target ) {
+ event.target = event.srcElement || document;
+ }
+
+ fn.call( elem, event );
+ });
}
}
}
function applyUrlParams() {
- var selectBox = id( "qunit-modulefilter" ),
- selection = decodeURIComponent( selectBox.options[ selectBox.selectedIndex ].value ),
+ var selectedModule,
+ modulesList = id( "qunit-modulefilter" ),
filter = id( "qunit-filter-input" ).value;
+ selectedModule = modulesList ?
+ decodeURIComponent( modulesList.options[ modulesList.selectedIndex ].value ) :
+ undefined;
+
window.location = setUrl({
- module: ( selection === "" ) ? undefined : selection,
+ module: ( selectedModule === "" ) ? undefined : selectedModule,
filter: ( filter === "" ) ? undefined : filter,
// Remove testId filter
function appendUserAgent() {
var userAgent = id( "qunit-userAgent" );
+
if ( userAgent ) {
userAgent.innerHTML = "";
- userAgent.appendChild( document.createTextNode( navigator.userAgent ) );
+ userAgent.appendChild(
+ document.createTextNode(
+ "QUnit " + QUnit.version + "; " + navigator.userAgent
+ )
+ );
}
}
}
QUnit.testStart(function( details ) {
- var running, testBlock;
+ var running, testBlock, bad;
testBlock = id( "qunit-test-output-" + details.testId );
if ( testBlock ) {
running = id( "qunit-testresult" );
if ( running ) {
- running.innerHTML = "Running: <br />" + getNameHtml( details.name, details.module );
+ bad = QUnit.config.reorder && defined.sessionStorage &&
+ +sessionStorage.getItem( "qunit-test-" + details.module + "-" + details.name );
+
+ running.innerHTML = ( bad ?
+ "Rerunning previously failed test: <br />" :
+ "Running: <br />" ) +
+ getNameHtml( details.name, details.module );
}
});
actual + "</pre></td></tr>" +
"<tr class='test-diff'><th>Diff: </th><td><pre>" +
QUnit.diff( expected, actual ) + "</pre></td></tr>";
+ } else {
+ if ( expected.indexOf( "[object Array]" ) !== -1 ||
+ expected.indexOf( "[object Object]" ) !== -1 ) {
+ message += "<tr class='test-message'><th>Message: </th><td>" +
+ "Diff suppressed as the depth of object is more than current max depth (" +
+ QUnit.config.maxDepth + ").<p>Hint: Use <code>QUnit.dump.maxDepth</code> to " +
+ " run with a higher max depth or <a href='" + setUrl({ maxDepth: -1 }) + "'>" +
+ "Rerun</a> without max depth.</p></td></tr>";
+ }
}
if ( details.source ) {
}
});
-if ( !defined.document || document.readyState === "complete" ) {
+if ( defined.document ) {
+ if ( document.readyState === "complete" ) {
+ QUnit.load();
+ } else {
+ addEvent( window, "load", QUnit.load );
+ }
+} else {
config.pageLoaded = true;
config.autorun = true;
}
-if ( defined.document ) {
- addEvent( window, "load", QUnit.load );
-}
-
})();
+++ /dev/null
-/**
- * Sinon.JS 1.15.0, 2015/05/30
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
- *
- * (The BSD License)
- *
- * Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of Christian Johansen nor the names of his contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-(function (root, factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- define('sinon', [], function () {
- return (root.sinon = factory());
- });
- } else if (typeof exports === 'object') {
- module.exports = factory();
- } else {
- root.sinon = factory();
- }
-}(this, function () {
- 'use strict';
- var samsam, formatio, lolex;
- (function () {
- function define(mod, deps, fn) {
- if (mod == "samsam") {
- samsam = deps();
- } else if (typeof deps === "function" && mod.length === 0) {
- lolex = deps();
- } else if (typeof fn === "function") {
- formatio = fn(samsam);
- }
- }
- define.amd = {};
-((typeof define === "function" && define.amd && function (m) { define("samsam", m); }) ||
- (typeof module === "object" &&
- function (m) { module.exports = m(); }) || // Node
- function (m) { this.samsam = m(); } // Browser globals
-)(function () {
- var o = Object.prototype;
- var div = typeof document !== "undefined" && document.createElement("div");
-
- function isNaN(value) {
- // Unlike global isNaN, this avoids type coercion
- // typeof check avoids IE host object issues, hat tip to
- // lodash
- var val = value; // JsLint thinks value !== value is "weird"
- return typeof value === "number" && value !== val;
- }
-
- function getClass(value) {
- // Returns the internal [[Class]] by calling Object.prototype.toString
- // with the provided value as this. Return value is a string, naming the
- // internal class, e.g. "Array"
- return o.toString.call(value).split(/[ \]]/)[1];
- }
-
- /**
- * @name samsam.isArguments
- * @param Object object
- *
- * Returns ``true`` if ``object`` is an ``arguments`` object,
- * ``false`` otherwise.
- */
- function isArguments(object) {
- if (getClass(object) === 'Arguments') { return true; }
- if (typeof object !== "object" || typeof object.length !== "number" ||
- getClass(object) === "Array") {
- return false;
- }
- if (typeof object.callee == "function") { return true; }
- try {
- object[object.length] = 6;
- delete object[object.length];
- } catch (e) {
- return true;
- }
- return false;
- }
-
- /**
- * @name samsam.isElement
- * @param Object object
- *
- * Returns ``true`` if ``object`` is a DOM element node. Unlike
- * Underscore.js/lodash, this function will return ``false`` if ``object``
- * is an *element-like* object, i.e. a regular object with a ``nodeType``
- * property that holds the value ``1``.
- */
- function isElement(object) {
- if (!object || object.nodeType !== 1 || !div) { return false; }
- try {
- object.appendChild(div);
- object.removeChild(div);
- } catch (e) {
- return false;
- }
- return true;
- }
-
- /**
- * @name samsam.keys
- * @param Object object
- *
- * Return an array of own property names.
- */
- function keys(object) {
- var ks = [], prop;
- for (prop in object) {
- if (o.hasOwnProperty.call(object, prop)) { ks.push(prop); }
- }
- return ks;
- }
-
- /**
- * @name samsam.isDate
- * @param Object value
- *
- * Returns true if the object is a ``Date``, or *date-like*. Duck typing
- * of date objects work by checking that the object has a ``getTime``
- * function whose return value equals the return value from the object's
- * ``valueOf``.
- */
- function isDate(value) {
- return typeof value.getTime == "function" &&
- value.getTime() == value.valueOf();
- }
-
- /**
- * @name samsam.isNegZero
- * @param Object value
- *
- * Returns ``true`` if ``value`` is ``-0``.
- */
- function isNegZero(value) {
- return value === 0 && 1 / value === -Infinity;
- }
-
- /**
- * @name samsam.equal
- * @param Object obj1
- * @param Object obj2
- *
- * Returns ``true`` if two objects are strictly equal. Compared to
- * ``===`` there are two exceptions:
- *
- * - NaN is considered equal to NaN
- * - -0 and +0 are not considered equal
- */
- function identical(obj1, obj2) {
- if (obj1 === obj2 || (isNaN(obj1) && isNaN(obj2))) {
- return obj1 !== 0 || isNegZero(obj1) === isNegZero(obj2);
- }
- }
-
-
- /**
- * @name samsam.deepEqual
- * @param Object obj1
- * @param Object obj2
- *
- * Deep equal comparison. Two values are "deep equal" if:
- *
- * - They are equal, according to samsam.identical
- * - They are both date objects representing the same time
- * - They are both arrays containing elements that are all deepEqual
- * - They are objects with the same set of properties, and each property
- * in ``obj1`` is deepEqual to the corresponding property in ``obj2``
- *
- * Supports cyclic objects.
- */
- function deepEqualCyclic(obj1, obj2) {
-
- // used for cyclic comparison
- // contain already visited objects
- var objects1 = [],
- objects2 = [],
- // contain pathes (position in the object structure)
- // of the already visited objects
- // indexes same as in objects arrays
- paths1 = [],
- paths2 = [],
- // contains combinations of already compared objects
- // in the manner: { "$1['ref']$2['ref']": true }
- compared = {};
-
- /**
- * used to check, if the value of a property is an object
- * (cyclic logic is only needed for objects)
- * only needed for cyclic logic
- */
- function isObject(value) {
-
- if (typeof value === 'object' && value !== null &&
- !(value instanceof Boolean) &&
- !(value instanceof Date) &&
- !(value instanceof Number) &&
- !(value instanceof RegExp) &&
- !(value instanceof String)) {
-
- return true;
- }
-
- return false;
- }
-
- /**
- * returns the index of the given object in the
- * given objects array, -1 if not contained
- * only needed for cyclic logic
- */
- function getIndex(objects, obj) {
-
- var i;
- for (i = 0; i < objects.length; i++) {
- if (objects[i] === obj) {
- return i;
- }
- }
-
- return -1;
- }
-
- // does the recursion for the deep equal check
- return (function deepEqual(obj1, obj2, path1, path2) {
- var type1 = typeof obj1;
- var type2 = typeof obj2;
-
- // == null also matches undefined
- if (obj1 === obj2 ||
- isNaN(obj1) || isNaN(obj2) ||
- obj1 == null || obj2 == null ||
- type1 !== "object" || type2 !== "object") {
-
- return identical(obj1, obj2);
- }
-
- // Elements are only equal if identical(expected, actual)
- if (isElement(obj1) || isElement(obj2)) { return false; }
-
- var isDate1 = isDate(obj1), isDate2 = isDate(obj2);
- if (isDate1 || isDate2) {
- if (!isDate1 || !isDate2 || obj1.getTime() !== obj2.getTime()) {
- return false;
- }
- }
-
- if (obj1 instanceof RegExp && obj2 instanceof RegExp) {
- if (obj1.toString() !== obj2.toString()) { return false; }
- }
-
- var class1 = getClass(obj1);
- var class2 = getClass(obj2);
- var keys1 = keys(obj1);
- var keys2 = keys(obj2);
-
- if (isArguments(obj1) || isArguments(obj2)) {
- if (obj1.length !== obj2.length) { return false; }
- } else {
- if (type1 !== type2 || class1 !== class2 ||
- keys1.length !== keys2.length) {
- return false;
- }
- }
-
- var key, i, l,
- // following vars are used for the cyclic logic
- value1, value2,
- isObject1, isObject2,
- index1, index2,
- newPath1, newPath2;
-
- for (i = 0, l = keys1.length; i < l; i++) {
- key = keys1[i];
- if (!o.hasOwnProperty.call(obj2, key)) {
- return false;
- }
-
- // Start of the cyclic logic
-
- value1 = obj1[key];
- value2 = obj2[key];
-
- isObject1 = isObject(value1);
- isObject2 = isObject(value2);
-
- // determine, if the objects were already visited
- // (it's faster to check for isObject first, than to
- // get -1 from getIndex for non objects)
- index1 = isObject1 ? getIndex(objects1, value1) : -1;
- index2 = isObject2 ? getIndex(objects2, value2) : -1;
-
- // determine the new pathes of the objects
- // - for non cyclic objects the current path will be extended
- // by current property name
- // - for cyclic objects the stored path is taken
- newPath1 = index1 !== -1
- ? paths1[index1]
- : path1 + '[' + JSON.stringify(key) + ']';
- newPath2 = index2 !== -1
- ? paths2[index2]
- : path2 + '[' + JSON.stringify(key) + ']';
-
- // stop recursion if current objects are already compared
- if (compared[newPath1 + newPath2]) {
- return true;
- }
-
- // remember the current objects and their pathes
- if (index1 === -1 && isObject1) {
- objects1.push(value1);
- paths1.push(newPath1);
- }
- if (index2 === -1 && isObject2) {
- objects2.push(value2);
- paths2.push(newPath2);
- }
-
- // remember that the current objects are already compared
- if (isObject1 && isObject2) {
- compared[newPath1 + newPath2] = true;
- }
-
- // End of cyclic logic
-
- // neither value1 nor value2 is a cycle
- // continue with next level
- if (!deepEqual(value1, value2, newPath1, newPath2)) {
- return false;
- }
- }
-
- return true;
-
- }(obj1, obj2, '$1', '$2'));
- }
-
- var match;
-
- function arrayContains(array, subset) {
- if (subset.length === 0) { return true; }
- var i, l, j, k;
- for (i = 0, l = array.length; i < l; ++i) {
- if (match(array[i], subset[0])) {
- for (j = 0, k = subset.length; j < k; ++j) {
- if (!match(array[i + j], subset[j])) { return false; }
- }
- return true;
- }
- }
- return false;
- }
-
- /**
- * @name samsam.match
- * @param Object object
- * @param Object matcher
- *
- * Compare arbitrary value ``object`` with matcher.
- */
- match = function match(object, matcher) {
- if (matcher && typeof matcher.test === "function") {
- return matcher.test(object);
- }
-
- if (typeof matcher === "function") {
- return matcher(object) === true;
- }
-
- if (typeof matcher === "string") {
- matcher = matcher.toLowerCase();
- var notNull = typeof object === "string" || !!object;
- return notNull &&
- (String(object)).toLowerCase().indexOf(matcher) >= 0;
- }
-
- if (typeof matcher === "number") {
- return matcher === object;
- }
-
- if (typeof matcher === "boolean") {
- return matcher === object;
- }
-
- if (typeof(matcher) === "undefined") {
- return typeof(object) === "undefined";
- }
-
- if (matcher === null) {
- return object === null;
- }
-
- if (getClass(object) === "Array" && getClass(matcher) === "Array") {
- return arrayContains(object, matcher);
- }
-
- if (matcher && typeof matcher === "object") {
- if (matcher === object) {
- return true;
- }
- var prop;
- for (prop in matcher) {
- var value = object[prop];
- if (typeof value === "undefined" &&
- typeof object.getAttribute === "function") {
- value = object.getAttribute(prop);
- }
- if (matcher[prop] === null || typeof matcher[prop] === 'undefined') {
- if (value !== matcher[prop]) {
- return false;
- }
- } else if (typeof value === "undefined" || !match(value, matcher[prop])) {
- return false;
- }
- }
- return true;
- }
-
- throw new Error("Matcher was not a string, a number, a " +
- "function, a boolean or an object");
- };
-
- return {
- isArguments: isArguments,
- isElement: isElement,
- isDate: isDate,
- isNegZero: isNegZero,
- identical: identical,
- deepEqual: deepEqualCyclic,
- match: match,
- keys: keys
- };
-});
-((typeof define === "function" && define.amd && function (m) {
- define("formatio", ["samsam"], m);
-}) || (typeof module === "object" && function (m) {
- module.exports = m(require("samsam"));
-}) || function (m) { this.formatio = m(this.samsam); }
-)(function (samsam) {
-
- var formatio = {
- excludeConstructors: ["Object", /^.$/],
- quoteStrings: true,
- limitChildrenCount: 0
- };
-
- var hasOwn = Object.prototype.hasOwnProperty;
-
- var specialObjects = [];
- if (typeof global !== "undefined") {
- specialObjects.push({ object: global, value: "[object global]" });
- }
- if (typeof document !== "undefined") {
- specialObjects.push({
- object: document,
- value: "[object HTMLDocument]"
- });
- }
- if (typeof window !== "undefined") {
- specialObjects.push({ object: window, value: "[object Window]" });
- }
-
- function functionName(func) {
- if (!func) { return ""; }
- if (func.displayName) { return func.displayName; }
- if (func.name) { return func.name; }
- var matches = func.toString().match(/function\s+([^\(]+)/m);
- return (matches && matches[1]) || "";
- }
-
- function constructorName(f, object) {
- var name = functionName(object && object.constructor);
- var excludes = f.excludeConstructors ||
- formatio.excludeConstructors || [];
-
- var i, l;
- for (i = 0, l = excludes.length; i < l; ++i) {
- if (typeof excludes[i] === "string" && excludes[i] === name) {
- return "";
- } else if (excludes[i].test && excludes[i].test(name)) {
- return "";
- }
- }
-
- return name;
- }
-
- function isCircular(object, objects) {
- if (typeof object !== "object") { return false; }
- var i, l;
- for (i = 0, l = objects.length; i < l; ++i) {
- if (objects[i] === object) { return true; }
- }
- return false;
- }
-
- function ascii(f, object, processed, indent) {
- if (typeof object === "string") {
- var qs = f.quoteStrings;
- var quote = typeof qs !== "boolean" || qs;
- return processed || quote ? '"' + object + '"' : object;
- }
-
- if (typeof object === "function" && !(object instanceof RegExp)) {
- return ascii.func(object);
- }
-
- processed = processed || [];
-
- if (isCircular(object, processed)) { return "[Circular]"; }
-
- if (Object.prototype.toString.call(object) === "[object Array]") {
- return ascii.array.call(f, object, processed);
- }
-
- if (!object) { return String((1/object) === -Infinity ? "-0" : object); }
- if (samsam.isElement(object)) { return ascii.element(object); }
-
- if (typeof object.toString === "function" &&
- object.toString !== Object.prototype.toString) {
- return object.toString();
- }
-
- var i, l;
- for (i = 0, l = specialObjects.length; i < l; i++) {
- if (object === specialObjects[i].object) {
- return specialObjects[i].value;
- }
- }
-
- return ascii.object.call(f, object, processed, indent);
- }
-
- ascii.func = function (func) {
- return "function " + functionName(func) + "() {}";
- };
-
- ascii.array = function (array, processed) {
- processed = processed || [];
- processed.push(array);
- var pieces = [];
- var i, l;
- l = (this.limitChildrenCount > 0) ?
- Math.min(this.limitChildrenCount, array.length) : array.length;
-
- for (i = 0; i < l; ++i) {
- pieces.push(ascii(this, array[i], processed));
- }
-
- if(l < array.length)
- pieces.push("[... " + (array.length - l) + " more elements]");
-
- return "[" + pieces.join(", ") + "]";
- };
-
- ascii.object = function (object, processed, indent) {
- processed = processed || [];
- processed.push(object);
- indent = indent || 0;
- var pieces = [], properties = samsam.keys(object).sort();
- var length = 3;
- var prop, str, obj, i, k, l;
- l = (this.limitChildrenCount > 0) ?
- Math.min(this.limitChildrenCount, properties.length) : properties.length;
-
- for (i = 0; i < l; ++i) {
- prop = properties[i];
- obj = object[prop];
-
- if (isCircular(obj, processed)) {
- str = "[Circular]";
- } else {
- str = ascii(this, obj, processed, indent + 2);
- }
-
- str = (/\s/.test(prop) ? '"' + prop + '"' : prop) + ": " + str;
- length += str.length;
- pieces.push(str);
- }
-
- var cons = constructorName(this, object);
- var prefix = cons ? "[" + cons + "] " : "";
- var is = "";
- for (i = 0, k = indent; i < k; ++i) { is += " "; }
-
- if(l < properties.length)
- pieces.push("[... " + (properties.length - l) + " more elements]");
-
- if (length + indent > 80) {
- return prefix + "{\n " + is + pieces.join(",\n " + is) + "\n" +
- is + "}";
- }
- return prefix + "{ " + pieces.join(", ") + " }";
- };
-
- ascii.element = function (element) {
- var tagName = element.tagName.toLowerCase();
- var attrs = element.attributes, attr, pairs = [], attrName, i, l, val;
-
- for (i = 0, l = attrs.length; i < l; ++i) {
- attr = attrs.item(i);
- attrName = attr.nodeName.toLowerCase().replace("html:", "");
- val = attr.nodeValue;
- if (attrName !== "contenteditable" || val !== "inherit") {
- if (!!val) { pairs.push(attrName + "=\"" + val + "\""); }
- }
- }
-
- var formatted = "<" + tagName + (pairs.length > 0 ? " " : "");
- var content = element.innerHTML;
-
- if (content.length > 20) {
- content = content.substr(0, 20) + "[...]";
- }
-
- var res = formatted + pairs.join(" ") + ">" + content +
- "</" + tagName + ">";
-
- return res.replace(/ contentEditable="inherit"/, "");
- };
-
- function Formatio(options) {
- for (var opt in options) {
- this[opt] = options[opt];
- }
- }
-
- Formatio.prototype = {
- functionName: functionName,
-
- configure: function (options) {
- return new Formatio(options);
- },
-
- constructorName: function (object) {
- return constructorName(this, object);
- },
-
- ascii: function (object, processed, indent) {
- return ascii(this, object, processed, indent);
- }
- };
-
- return Formatio.prototype;
-});
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.lolex=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
-(function (global){
-/*jslint eqeqeq: false, plusplus: false, evil: true, onevar: false, browser: true, forin: false*/
-/*global global*/
-/**
- * @author Christian Johansen (christian@cjohansen.no) and contributors
- * @license BSD
- *
- * Copyright (c) 2010-2014 Christian Johansen
- */
-
-// node expects setTimeout/setInterval to return a fn object w/ .ref()/.unref()
-// browsers, a number.
-// see https://github.com/cjohansen/Sinon.JS/pull/436
-var timeoutResult = setTimeout(function() {}, 0);
-var addTimerReturnsObject = typeof timeoutResult === "object";
-clearTimeout(timeoutResult);
-
-var NativeDate = Date;
-var id = 1;
-
-/**
- * Parse strings like "01:10:00" (meaning 1 hour, 10 minutes, 0 seconds) into
- * number of milliseconds. This is used to support human-readable strings passed
- * to clock.tick()
- */
-function parseTime(str) {
- if (!str) {
- return 0;
- }
-
- var strings = str.split(":");
- var l = strings.length, i = l;
- var ms = 0, parsed;
-
- if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) {
- throw new Error("tick only understands numbers and 'h:m:s'");
- }
-
- while (i--) {
- parsed = parseInt(strings[i], 10);
-
- if (parsed >= 60) {
- throw new Error("Invalid time " + str);
- }
-
- ms += parsed * Math.pow(60, (l - i - 1));
- }
-
- return ms * 1000;
-}
-
-/**
- * Used to grok the `now` parameter to createClock.
- */
-function getEpoch(epoch) {
- if (!epoch) { return 0; }
- if (typeof epoch.getTime === "function") { return epoch.getTime(); }
- if (typeof epoch === "number") { return epoch; }
- throw new TypeError("now should be milliseconds since UNIX epoch");
-}
-
-function inRange(from, to, timer) {
- return timer && timer.callAt >= from && timer.callAt <= to;
-}
-
-function mirrorDateProperties(target, source) {
- if (source.now) {
- target.now = function now() {
- return target.clock.now;
- };
- } else {
- delete target.now;
- }
-
- if (source.toSource) {
- target.toSource = function toSource() {
- return source.toSource();
- };
- } else {
- delete target.toSource;
- }
-
- target.toString = function toString() {
- return source.toString();
- };
-
- target.prototype = source.prototype;
- target.parse = source.parse;
- target.UTC = source.UTC;
- target.prototype.toUTCString = source.prototype.toUTCString;
-
- for (var prop in source) {
- if (source.hasOwnProperty(prop)) {
- target[prop] = source[prop];
- }
- }
-
- return target;
-}
-
-function createDate() {
- function ClockDate(year, month, date, hour, minute, second, ms) {
- // Defensive and verbose to avoid potential harm in passing
- // explicit undefined when user does not pass argument
- switch (arguments.length) {
- case 0:
- return new NativeDate(ClockDate.clock.now);
- case 1:
- return new NativeDate(year);
- case 2:
- return new NativeDate(year, month);
- case 3:
- return new NativeDate(year, month, date);
- case 4:
- return new NativeDate(year, month, date, hour);
- case 5:
- return new NativeDate(year, month, date, hour, minute);
- case 6:
- return new NativeDate(year, month, date, hour, minute, second);
- default:
- return new NativeDate(year, month, date, hour, minute, second, ms);
- }
- }
-
- return mirrorDateProperties(ClockDate, NativeDate);
-}
-
-function addTimer(clock, timer) {
- if (typeof timer.func === "undefined") {
- throw new Error("Callback must be provided to timer calls");
- }
-
- if (!clock.timers) {
- clock.timers = {};
- }
-
- timer.id = id++;
- timer.createdAt = clock.now;
- timer.callAt = clock.now + (timer.delay || 0);
-
- clock.timers[timer.id] = timer;
-
- if (addTimerReturnsObject) {
- return {
- id: timer.id,
- ref: function() {},
- unref: function() {}
- };
- }
- else {
- return timer.id;
- }
-}
-
-function firstTimerInRange(clock, from, to) {
- var timers = clock.timers, timer = null;
-
- for (var id in timers) {
- if (!inRange(from, to, timers[id])) {
- continue;
- }
-
- if (!timer || ~compareTimers(timer, timers[id])) {
- timer = timers[id];
- }
- }
-
- return timer;
-}
-
-function compareTimers(a, b) {
- // Sort first by absolute timing
- if (a.callAt < b.callAt) {
- return -1;
- }
- if (a.callAt > b.callAt) {
- return 1;
- }
-
- // Sort next by immediate, immediate timers take precedence
- if (a.immediate && !b.immediate) {
- return -1;
- }
- if (!a.immediate && b.immediate) {
- return 1;
- }
-
- // Sort next by creation time, earlier-created timers take precedence
- if (a.createdAt < b.createdAt) {
- return -1;
- }
- if (a.createdAt > b.createdAt) {
- return 1;
- }
-
- // Sort next by id, lower-id timers take precedence
- if (a.id < b.id) {
- return -1;
- }
- if (a.id > b.id) {
- return 1;
- }
-
- // As timer ids are unique, no fallback `0` is necessary
-}
-
-function callTimer(clock, timer) {
- if (typeof timer.interval == "number") {
- clock.timers[timer.id].callAt += timer.interval;
- } else {
- delete clock.timers[timer.id];
- }
-
- try {
- if (typeof timer.func == "function") {
- timer.func.apply(null, timer.args);
- } else {
- eval(timer.func);
- }
- } catch (e) {
- var exception = e;
- }
-
- if (!clock.timers[timer.id]) {
- if (exception) {
- throw exception;
- }
- return;
- }
-
- if (exception) {
- throw exception;
- }
-}
-
-function uninstall(clock, target) {
- var method;
-
- for (var i = 0, l = clock.methods.length; i < l; i++) {
- method = clock.methods[i];
-
- if (target[method].hadOwnProperty) {
- target[method] = clock["_" + method];
- } else {
- try {
- delete target[method];
- } catch (e) {}
- }
- }
-
- // Prevent multiple executions which will completely remove these props
- clock.methods = [];
-}
-
-function hijackMethod(target, method, clock) {
- clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(target, method);
- clock["_" + method] = target[method];
-
- if (method == "Date") {
- var date = mirrorDateProperties(clock[method], target[method]);
- target[method] = date;
- } else {
- target[method] = function () {
- return clock[method].apply(clock, arguments);
- };
-
- for (var prop in clock[method]) {
- if (clock[method].hasOwnProperty(prop)) {
- target[method][prop] = clock[method][prop];
- }
- }
- }
-
- target[method].clock = clock;
-}
-
-var timers = {
- setTimeout: setTimeout,
- clearTimeout: clearTimeout,
- setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined),
- clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate: undefined),
- setInterval: setInterval,
- clearInterval: clearInterval,
- Date: Date
-};
-
-var keys = Object.keys || function (obj) {
- var ks = [];
- for (var key in obj) {
- ks.push(key);
- }
- return ks;
-};
-
-exports.timers = timers;
-
-var createClock = exports.createClock = function (now) {
- var clock = {
- now: getEpoch(now),
- timeouts: {},
- Date: createDate()
- };
-
- clock.Date.clock = clock;
-
- clock.setTimeout = function setTimeout(func, timeout) {
- return addTimer(clock, {
- func: func,
- args: Array.prototype.slice.call(arguments, 2),
- delay: timeout
- });
- };
-
- clock.clearTimeout = function clearTimeout(timerId) {
- if (!timerId) {
- // null appears to be allowed in most browsers, and appears to be
- // relied upon by some libraries, like Bootstrap carousel
- return;
- }
- if (!clock.timers) {
- clock.timers = [];
- }
- // in Node, timerId is an object with .ref()/.unref(), and
- // its .id field is the actual timer id.
- if (typeof timerId === "object") {
- timerId = timerId.id
- }
- if (timerId in clock.timers) {
- delete clock.timers[timerId];
- }
- };
-
- clock.setInterval = function setInterval(func, timeout) {
- return addTimer(clock, {
- func: func,
- args: Array.prototype.slice.call(arguments, 2),
- delay: timeout,
- interval: timeout
- });
- };
-
- clock.clearInterval = function clearInterval(timerId) {
- clock.clearTimeout(timerId);
- };
-
- clock.setImmediate = function setImmediate(func) {
- return addTimer(clock, {
- func: func,
- args: Array.prototype.slice.call(arguments, 1),
- immediate: true
- });
- };
-
- clock.clearImmediate = function clearImmediate(timerId) {
- clock.clearTimeout(timerId);
- };
-
- clock.tick = function tick(ms) {
- ms = typeof ms == "number" ? ms : parseTime(ms);
- var tickFrom = clock.now, tickTo = clock.now + ms, previous = clock.now;
- var timer = firstTimerInRange(clock, tickFrom, tickTo);
-
- var firstException;
- while (timer && tickFrom <= tickTo) {
- if (clock.timers[timer.id]) {
- tickFrom = clock.now = timer.callAt;
- try {
- callTimer(clock, timer);
- } catch (e) {
- firstException = firstException || e;
- }
- }
-
- timer = firstTimerInRange(clock, previous, tickTo);
- previous = tickFrom;
- }
-
- clock.now = tickTo;
-
- if (firstException) {
- throw firstException;
- }
-
- return clock.now;
- };
-
- clock.reset = function reset() {
- clock.timers = {};
- };
-
- return clock;
-};
-
-exports.install = function install(target, now, toFake) {
- if (typeof target === "number") {
- toFake = now;
- now = target;
- target = null;
- }
-
- if (!target) {
- target = global;
- }
-
- var clock = createClock(now);
-
- clock.uninstall = function () {
- uninstall(clock, target);
- };
-
- clock.methods = toFake || [];
-
- if (clock.methods.length === 0) {
- clock.methods = keys(timers);
- }
-
- for (var i = 0, l = clock.methods.length; i < l; i++) {
- hijackMethod(target, clock.methods[i], clock);
- }
-
- return clock;
-};
-
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}]},{},[1])(1)
-});
- })();
- var define;
-/**
- * Sinon core utilities. For internal use only.
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-var sinon = (function () {
-"use strict";
-
- var sinon;
- var isNode = typeof module !== "undefined" && module.exports && typeof require === "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- sinon = module.exports = require("./sinon/util/core");
- require("./sinon/extend");
- require("./sinon/typeOf");
- require("./sinon/times_in_words");
- require("./sinon/spy");
- require("./sinon/call");
- require("./sinon/behavior");
- require("./sinon/stub");
- require("./sinon/mock");
- require("./sinon/collection");
- require("./sinon/assert");
- require("./sinon/sandbox");
- require("./sinon/test");
- require("./sinon/test_case");
- require("./sinon/match");
- require("./sinon/format");
- require("./sinon/log_error");
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- sinon = module.exports;
- } else {
- sinon = {};
- }
-
- return sinon;
-}());
-
-/**
- * @depend ../../sinon.js
- */
-/**
- * Sinon core utilities. For internal use only.
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function (sinon) {
- var div = typeof document != "undefined" && document.createElement("div");
- var hasOwn = Object.prototype.hasOwnProperty;
-
- function isDOMNode(obj) {
- var success = false;
-
- try {
- obj.appendChild(div);
- success = div.parentNode == obj;
- } catch (e) {
- return false;
- } finally {
- try {
- obj.removeChild(div);
- } catch (e) {
- // Remove failed, not much we can do about that
- }
- }
-
- return success;
- }
-
- function isElement(obj) {
- return div && obj && obj.nodeType === 1 && isDOMNode(obj);
- }
-
- function isFunction(obj) {
- return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply);
- }
-
- function isReallyNaN(val) {
- return typeof val === "number" && isNaN(val);
- }
-
- function mirrorProperties(target, source) {
- for (var prop in source) {
- if (!hasOwn.call(target, prop)) {
- target[prop] = source[prop];
- }
- }
- }
-
- function isRestorable(obj) {
- return typeof obj === "function" && typeof obj.restore === "function" && obj.restore.sinon;
- }
-
- // Cheap way to detect if we have ES5 support.
- var hasES5Support = "keys" in Object;
-
- function makeApi(sinon) {
- sinon.wrapMethod = function wrapMethod(object, property, method) {
- if (!object) {
- throw new TypeError("Should wrap property of object");
- }
-
- if (typeof method != "function" && typeof method != "object") {
- throw new TypeError("Method wrapper should be a function or a property descriptor");
- }
-
- function checkWrappedMethod(wrappedMethod) {
- if (!isFunction(wrappedMethod)) {
- error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " +
- property + " as function");
- } else if (wrappedMethod.restore && wrappedMethod.restore.sinon) {
- error = new TypeError("Attempted to wrap " + property + " which is already wrapped");
- } else if (wrappedMethod.calledBefore) {
- var verb = !!wrappedMethod.returns ? "stubbed" : "spied on";
- error = new TypeError("Attempted to wrap " + property + " which is already " + verb);
- }
-
- if (error) {
- if (wrappedMethod && wrappedMethod.stackTrace) {
- error.stack += "\n--------------\n" + wrappedMethod.stackTrace;
- }
- throw error;
- }
- }
-
- var error, wrappedMethod;
-
- // IE 8 does not support hasOwnProperty on the window object and Firefox has a problem
- // when using hasOwn.call on objects from other frames.
- var owned = object.hasOwnProperty ? object.hasOwnProperty(property) : hasOwn.call(object, property);
-
- if (hasES5Support) {
- var methodDesc = (typeof method == "function") ? {value: method} : method,
- wrappedMethodDesc = sinon.getPropertyDescriptor(object, property),
- i;
-
- if (!wrappedMethodDesc) {
- error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " +
- property + " as function");
- } else if (wrappedMethodDesc.restore && wrappedMethodDesc.restore.sinon) {
- error = new TypeError("Attempted to wrap " + property + " which is already wrapped");
- }
- if (error) {
- if (wrappedMethodDesc && wrappedMethodDesc.stackTrace) {
- error.stack += "\n--------------\n" + wrappedMethodDesc.stackTrace;
- }
- throw error;
- }
-
- var types = sinon.objectKeys(methodDesc);
- for (i = 0; i < types.length; i++) {
- wrappedMethod = wrappedMethodDesc[types[i]];
- checkWrappedMethod(wrappedMethod);
- }
-
- mirrorProperties(methodDesc, wrappedMethodDesc);
- for (i = 0; i < types.length; i++) {
- mirrorProperties(methodDesc[types[i]], wrappedMethodDesc[types[i]]);
- }
- Object.defineProperty(object, property, methodDesc);
- } else {
- wrappedMethod = object[property];
- checkWrappedMethod(wrappedMethod);
- object[property] = method;
- method.displayName = property;
- }
-
- method.displayName = property;
-
- // Set up a stack trace which can be used later to find what line of
- // code the original method was created on.
- method.stackTrace = (new Error("Stack Trace for original")).stack;
-
- method.restore = function () {
- // For prototype properties try to reset by delete first.
- // If this fails (ex: localStorage on mobile safari) then force a reset
- // via direct assignment.
- if (!owned) {
- // In some cases `delete` may throw an error
- try {
- delete object[property];
- } catch (e) {}
- // For native code functions `delete` fails without throwing an error
- // on Chrome < 43, PhantomJS, etc.
- } else if (hasES5Support) {
- Object.defineProperty(object, property, wrappedMethodDesc);
- }
-
- // Use strict equality comparison to check failures then force a reset
- // via direct assignment.
- if (object[property] === method) {
- object[property] = wrappedMethod;
- }
- };
-
- method.restore.sinon = true;
-
- if (!hasES5Support) {
- mirrorProperties(method, wrappedMethod);
- }
-
- return method;
- };
-
- sinon.create = function create(proto) {
- var F = function () {};
- F.prototype = proto;
- return new F();
- };
-
- sinon.deepEqual = function deepEqual(a, b) {
- if (sinon.match && sinon.match.isMatcher(a)) {
- return a.test(b);
- }
-
- if (typeof a != "object" || typeof b != "object") {
- if (isReallyNaN(a) && isReallyNaN(b)) {
- return true;
- } else {
- return a === b;
- }
- }
-
- if (isElement(a) || isElement(b)) {
- return a === b;
- }
-
- if (a === b) {
- return true;
- }
-
- if ((a === null && b !== null) || (a !== null && b === null)) {
- return false;
- }
-
- if (a instanceof RegExp && b instanceof RegExp) {
- return (a.source === b.source) && (a.global === b.global) &&
- (a.ignoreCase === b.ignoreCase) && (a.multiline === b.multiline);
- }
-
- var aString = Object.prototype.toString.call(a);
- if (aString != Object.prototype.toString.call(b)) {
- return false;
- }
-
- if (aString == "[object Date]") {
- return a.valueOf() === b.valueOf();
- }
-
- var prop, aLength = 0, bLength = 0;
-
- if (aString == "[object Array]" && a.length !== b.length) {
- return false;
- }
-
- for (prop in a) {
- aLength += 1;
-
- if (!(prop in b)) {
- return false;
- }
-
- if (!deepEqual(a[prop], b[prop])) {
- return false;
- }
- }
-
- for (prop in b) {
- bLength += 1;
- }
-
- return aLength == bLength;
- };
-
- sinon.functionName = function functionName(func) {
- var name = func.displayName || func.name;
-
- // Use function decomposition as a last resort to get function
- // name. Does not rely on function decomposition to work - if it
- // doesn't debugging will be slightly less informative
- // (i.e. toString will say 'spy' rather than 'myFunc').
- if (!name) {
- var matches = func.toString().match(/function ([^\s\(]+)/);
- name = matches && matches[1];
- }
-
- return name;
- };
-
- sinon.functionToString = function toString() {
- if (this.getCall && this.callCount) {
- var thisValue, prop, i = this.callCount;
-
- while (i--) {
- thisValue = this.getCall(i).thisValue;
-
- for (prop in thisValue) {
- if (thisValue[prop] === this) {
- return prop;
- }
- }
- }
- }
-
- return this.displayName || "sinon fake";
- };
-
- sinon.objectKeys = function objectKeys(obj) {
- if (obj !== Object(obj)) {
- throw new TypeError("sinon.objectKeys called on a non-object");
- }
-
- var keys = [];
- var key;
- for (key in obj) {
- if (hasOwn.call(obj, key)) {
- keys.push(key);
- }
- }
-
- return keys;
- };
-
- sinon.getPropertyDescriptor = function getPropertyDescriptor(object, property) {
- var proto = object, descriptor;
- while (proto && !(descriptor = Object.getOwnPropertyDescriptor(proto, property))) {
- proto = Object.getPrototypeOf(proto);
- }
- return descriptor;
- }
-
- sinon.getConfig = function (custom) {
- var config = {};
- custom = custom || {};
- var defaults = sinon.defaultConfig;
-
- for (var prop in defaults) {
- if (defaults.hasOwnProperty(prop)) {
- config[prop] = custom.hasOwnProperty(prop) ? custom[prop] : defaults[prop];
- }
- }
-
- return config;
- };
-
- sinon.defaultConfig = {
- injectIntoThis: true,
- injectInto: null,
- properties: ["spy", "stub", "mock", "clock", "server", "requests"],
- useFakeTimers: true,
- useFakeServer: true
- };
-
- sinon.timesInWords = function timesInWords(count) {
- return count == 1 && "once" ||
- count == 2 && "twice" ||
- count == 3 && "thrice" ||
- (count || 0) + " times";
- };
-
- sinon.calledInOrder = function (spies) {
- for (var i = 1, l = spies.length; i < l; i++) {
- if (!spies[i - 1].calledBefore(spies[i]) || !spies[i].called) {
- return false;
- }
- }
-
- return true;
- };
-
- sinon.orderByFirstCall = function (spies) {
- return spies.sort(function (a, b) {
- // uuid, won't ever be equal
- var aCall = a.getCall(0);
- var bCall = b.getCall(0);
- var aId = aCall && aCall.callId || -1;
- var bId = bCall && bCall.callId || -1;
-
- return aId < bId ? -1 : 1;
- });
- };
-
- sinon.createStubInstance = function (constructor) {
- if (typeof constructor !== "function") {
- throw new TypeError("The constructor should be a function.");
- }
- return sinon.stub(sinon.create(constructor.prototype));
- };
-
- sinon.restore = function (object) {
- if (object !== null && typeof object === "object") {
- for (var prop in object) {
- if (isRestorable(object[prop])) {
- object[prop].restore();
- }
- }
- } else if (isRestorable(object)) {
- object.restore();
- }
- };
-
- return sinon;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports) {
- makeApi(exports);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend util/core.js
- */
-
-(function (sinon) {
- function makeApi(sinon) {
-
- // Adapted from https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
- var hasDontEnumBug = (function () {
- var obj = {
- constructor: function () {
- return "0";
- },
- toString: function () {
- return "1";
- },
- valueOf: function () {
- return "2";
- },
- toLocaleString: function () {
- return "3";
- },
- prototype: function () {
- return "4";
- },
- isPrototypeOf: function () {
- return "5";
- },
- propertyIsEnumerable: function () {
- return "6";
- },
- hasOwnProperty: function () {
- return "7";
- },
- length: function () {
- return "8";
- },
- unique: function () {
- return "9"
- }
- };
-
- var result = [];
- for (var prop in obj) {
- result.push(obj[prop]());
- }
- return result.join("") !== "0123456789";
- })();
-
- /* Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will
- * override properties in previous sources.
- *
- * target - The Object to extend
- * sources - Objects to copy properties from.
- *
- * Returns the extended target
- */
- function extend(target /*, sources */) {
- var sources = Array.prototype.slice.call(arguments, 1),
- source, i, prop;
-
- for (i = 0; i < sources.length; i++) {
- source = sources[i];
-
- for (prop in source) {
- if (source.hasOwnProperty(prop)) {
- target[prop] = source[prop];
- }
- }
-
- // Make sure we copy (own) toString method even when in JScript with DontEnum bug
- // See https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
- if (hasDontEnumBug && source.hasOwnProperty("toString") && source.toString !== target.toString) {
- target.toString = source.toString;
- }
- }
-
- return target;
- };
-
- sinon.extend = extend;
- return sinon.extend;
- }
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- module.exports = makeApi(sinon);
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend util/core.js
- */
-
-(function (sinon) {
- function makeApi(sinon) {
-
- function timesInWords(count) {
- switch (count) {
- case 1:
- return "once";
- case 2:
- return "twice";
- case 3:
- return "thrice";
- default:
- return (count || 0) + " times";
- }
- }
-
- sinon.timesInWords = timesInWords;
- return sinon.timesInWords;
- }
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- module.exports = makeApi(sinon);
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend util/core.js
- */
-/**
- * Format functions
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2014 Christian Johansen
- */
-
-(function (sinon, formatio) {
- function makeApi(sinon) {
- function typeOf(value) {
- if (value === null) {
- return "null";
- } else if (value === undefined) {
- return "undefined";
- }
- var string = Object.prototype.toString.call(value);
- return string.substring(8, string.length - 1).toLowerCase();
- };
-
- sinon.typeOf = typeOf;
- return sinon.typeOf;
- }
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- module.exports = makeApi(sinon);
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(
- (typeof sinon == "object" && sinon || null),
- (typeof formatio == "object" && formatio)
-));
-
-/**
- * @depend util/core.js
- * @depend typeOf.js
- */
-/*jslint eqeqeq: false, onevar: false, plusplus: false*/
-/*global module, require, sinon*/
-/**
- * Match functions
- *
- * @author Maximilian Antoni (mail@maxantoni.de)
- * @license BSD
- *
- * Copyright (c) 2012 Maximilian Antoni
- */
-
-(function (sinon) {
- function makeApi(sinon) {
- function assertType(value, type, name) {
- var actual = sinon.typeOf(value);
- if (actual !== type) {
- throw new TypeError("Expected type of " + name + " to be " +
- type + ", but was " + actual);
- }
- }
-
- var matcher = {
- toString: function () {
- return this.message;
- }
- };
-
- function isMatcher(object) {
- return matcher.isPrototypeOf(object);
- }
-
- function matchObject(expectation, actual) {
- if (actual === null || actual === undefined) {
- return false;
- }
- for (var key in expectation) {
- if (expectation.hasOwnProperty(key)) {
- var exp = expectation[key];
- var act = actual[key];
- if (match.isMatcher(exp)) {
- if (!exp.test(act)) {
- return false;
- }
- } else if (sinon.typeOf(exp) === "object") {
- if (!matchObject(exp, act)) {
- return false;
- }
- } else if (!sinon.deepEqual(exp, act)) {
- return false;
- }
- }
- }
- return true;
- }
-
- matcher.or = function (m2) {
- if (!arguments.length) {
- throw new TypeError("Matcher expected");
- } else if (!isMatcher(m2)) {
- m2 = match(m2);
- }
- var m1 = this;
- var or = sinon.create(matcher);
- or.test = function (actual) {
- return m1.test(actual) || m2.test(actual);
- };
- or.message = m1.message + ".or(" + m2.message + ")";
- return or;
- };
-
- matcher.and = function (m2) {
- if (!arguments.length) {
- throw new TypeError("Matcher expected");
- } else if (!isMatcher(m2)) {
- m2 = match(m2);
- }
- var m1 = this;
- var and = sinon.create(matcher);
- and.test = function (actual) {
- return m1.test(actual) && m2.test(actual);
- };
- and.message = m1.message + ".and(" + m2.message + ")";
- return and;
- };
-
- var match = function (expectation, message) {
- var m = sinon.create(matcher);
- var type = sinon.typeOf(expectation);
- switch (type) {
- case "object":
- if (typeof expectation.test === "function") {
- m.test = function (actual) {
- return expectation.test(actual) === true;
- };
- m.message = "match(" + sinon.functionName(expectation.test) + ")";
- return m;
- }
- var str = [];
- for (var key in expectation) {
- if (expectation.hasOwnProperty(key)) {
- str.push(key + ": " + expectation[key]);
- }
- }
- m.test = function (actual) {
- return matchObject(expectation, actual);
- };
- m.message = "match(" + str.join(", ") + ")";
- break;
- case "number":
- m.test = function (actual) {
- return expectation == actual;
- };
- break;
- case "string":
- m.test = function (actual) {
- if (typeof actual !== "string") {
- return false;
- }
- return actual.indexOf(expectation) !== -1;
- };
- m.message = "match(\"" + expectation + "\")";
- break;
- case "regexp":
- m.test = function (actual) {
- if (typeof actual !== "string") {
- return false;
- }
- return expectation.test(actual);
- };
- break;
- case "function":
- m.test = expectation;
- if (message) {
- m.message = message;
- } else {
- m.message = "match(" + sinon.functionName(expectation) + ")";
- }
- break;
- default:
- m.test = function (actual) {
- return sinon.deepEqual(expectation, actual);
- };
- }
- if (!m.message) {
- m.message = "match(" + expectation + ")";
- }
- return m;
- };
-
- match.isMatcher = isMatcher;
-
- match.any = match(function () {
- return true;
- }, "any");
-
- match.defined = match(function (actual) {
- return actual !== null && actual !== undefined;
- }, "defined");
-
- match.truthy = match(function (actual) {
- return !!actual;
- }, "truthy");
-
- match.falsy = match(function (actual) {
- return !actual;
- }, "falsy");
-
- match.same = function (expectation) {
- return match(function (actual) {
- return expectation === actual;
- }, "same(" + expectation + ")");
- };
-
- match.typeOf = function (type) {
- assertType(type, "string", "type");
- return match(function (actual) {
- return sinon.typeOf(actual) === type;
- }, "typeOf(\"" + type + "\")");
- };
-
- match.instanceOf = function (type) {
- assertType(type, "function", "type");
- return match(function (actual) {
- return actual instanceof type;
- }, "instanceOf(" + sinon.functionName(type) + ")");
- };
-
- function createPropertyMatcher(propertyTest, messagePrefix) {
- return function (property, value) {
- assertType(property, "string", "property");
- var onlyProperty = arguments.length === 1;
- var message = messagePrefix + "(\"" + property + "\"";
- if (!onlyProperty) {
- message += ", " + value;
- }
- message += ")";
- return match(function (actual) {
- if (actual === undefined || actual === null ||
- !propertyTest(actual, property)) {
- return false;
- }
- return onlyProperty || sinon.deepEqual(value, actual[property]);
- }, message);
- };
- }
-
- match.has = createPropertyMatcher(function (actual, property) {
- if (typeof actual === "object") {
- return property in actual;
- }
- return actual[property] !== undefined;
- }, "has");
-
- match.hasOwn = createPropertyMatcher(function (actual, property) {
- return actual.hasOwnProperty(property);
- }, "hasOwn");
-
- match.bool = match.typeOf("boolean");
- match.number = match.typeOf("number");
- match.string = match.typeOf("string");
- match.object = match.typeOf("object");
- match.func = match.typeOf("function");
- match.array = match.typeOf("array");
- match.regexp = match.typeOf("regexp");
- match.date = match.typeOf("date");
-
- sinon.match = match;
- return match;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- require("./typeOf");
- module.exports = makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend util/core.js
- */
-/**
- * Format functions
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2014 Christian Johansen
- */
-
-(function (sinon, formatio) {
- function makeApi(sinon) {
- function valueFormatter(value) {
- return "" + value;
- }
-
- function getFormatioFormatter() {
- var formatter = formatio.configure({
- quoteStrings: false,
- limitChildrenCount: 250
- });
-
- function format() {
- return formatter.ascii.apply(formatter, arguments);
- };
-
- return format;
- }
-
- function getNodeFormatter(value) {
- function format(value) {
- return typeof value == "object" && value.toString === Object.prototype.toString ? util.inspect(value) : value;
- };
-
- try {
- var util = require("util");
- } catch (e) {
- /* Node, but no util module - would be very old, but better safe than sorry */
- }
-
- return util ? format : valueFormatter;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function",
- formatter;
-
- if (isNode) {
- try {
- formatio = require("formatio");
- } catch (e) {}
- }
-
- if (formatio) {
- formatter = getFormatioFormatter()
- } else if (isNode) {
- formatter = getNodeFormatter();
- } else {
- formatter = valueFormatter;
- }
-
- sinon.format = formatter;
- return sinon.format;
- }
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- module.exports = makeApi(sinon);
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(
- (typeof sinon == "object" && sinon || null),
- (typeof formatio == "object" && formatio)
-));
-
-/**
- * @depend util/core.js
- * @depend match.js
- * @depend format.js
- */
-/**
- * Spy calls
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @author Maximilian Antoni (mail@maxantoni.de)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- * Copyright (c) 2013 Maximilian Antoni
- */
-
-(function (sinon) {
- function makeApi(sinon) {
- function throwYieldError(proxy, text, args) {
- var msg = sinon.functionName(proxy) + text;
- if (args.length) {
- msg += " Received [" + slice.call(args).join(", ") + "]";
- }
- throw new Error(msg);
- }
-
- var slice = Array.prototype.slice;
-
- var callProto = {
- calledOn: function calledOn(thisValue) {
- if (sinon.match && sinon.match.isMatcher(thisValue)) {
- return thisValue.test(this.thisValue);
- }
- return this.thisValue === thisValue;
- },
-
- calledWith: function calledWith() {
- var l = arguments.length;
- if (l > this.args.length) {
- return false;
- }
- for (var i = 0; i < l; i += 1) {
- if (!sinon.deepEqual(arguments[i], this.args[i])) {
- return false;
- }
- }
-
- return true;
- },
-
- calledWithMatch: function calledWithMatch() {
- var l = arguments.length;
- if (l > this.args.length) {
- return false;
- }
- for (var i = 0; i < l; i += 1) {
- var actual = this.args[i];
- var expectation = arguments[i];
- if (!sinon.match || !sinon.match(expectation).test(actual)) {
- return false;
- }
- }
- return true;
- },
-
- calledWithExactly: function calledWithExactly() {
- return arguments.length == this.args.length &&
- this.calledWith.apply(this, arguments);
- },
-
- notCalledWith: function notCalledWith() {
- return !this.calledWith.apply(this, arguments);
- },
-
- notCalledWithMatch: function notCalledWithMatch() {
- return !this.calledWithMatch.apply(this, arguments);
- },
-
- returned: function returned(value) {
- return sinon.deepEqual(value, this.returnValue);
- },
-
- threw: function threw(error) {
- if (typeof error === "undefined" || !this.exception) {
- return !!this.exception;
- }
-
- return this.exception === error || this.exception.name === error;
- },
-
- calledWithNew: function calledWithNew() {
- return this.proxy.prototype && this.thisValue instanceof this.proxy;
- },
-
- calledBefore: function (other) {
- return this.callId < other.callId;
- },
-
- calledAfter: function (other) {
- return this.callId > other.callId;
- },
-
- callArg: function (pos) {
- this.args[pos]();
- },
-
- callArgOn: function (pos, thisValue) {
- this.args[pos].apply(thisValue);
- },
-
- callArgWith: function (pos) {
- this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1)));
- },
-
- callArgOnWith: function (pos, thisValue) {
- var args = slice.call(arguments, 2);
- this.args[pos].apply(thisValue, args);
- },
-
- yield: function () {
- this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0)));
- },
-
- yieldOn: function (thisValue) {
- var args = this.args;
- for (var i = 0, l = args.length; i < l; ++i) {
- if (typeof args[i] === "function") {
- args[i].apply(thisValue, slice.call(arguments, 1));
- return;
- }
- }
- throwYieldError(this.proxy, " cannot yield since no callback was passed.", args);
- },
-
- yieldTo: function (prop) {
- this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1)));
- },
-
- yieldToOn: function (prop, thisValue) {
- var args = this.args;
- for (var i = 0, l = args.length; i < l; ++i) {
- if (args[i] && typeof args[i][prop] === "function") {
- args[i][prop].apply(thisValue, slice.call(arguments, 2));
- return;
- }
- }
- throwYieldError(this.proxy, " cannot yield to '" + prop +
- "' since no callback was passed.", args);
- },
-
- toString: function () {
- var callStr = this.proxy.toString() + "(";
- var args = [];
-
- for (var i = 0, l = this.args.length; i < l; ++i) {
- args.push(sinon.format(this.args[i]));
- }
-
- callStr = callStr + args.join(", ") + ")";
-
- if (typeof this.returnValue != "undefined") {
- callStr += " => " + sinon.format(this.returnValue);
- }
-
- if (this.exception) {
- callStr += " !" + this.exception.name;
-
- if (this.exception.message) {
- callStr += "(" + this.exception.message + ")";
- }
- }
-
- return callStr;
- }
- };
-
- callProto.invokeCallback = callProto.yield;
-
- function createSpyCall(spy, thisValue, args, returnValue, exception, id) {
- if (typeof id !== "number") {
- throw new TypeError("Call id is not a number");
- }
- var proxyCall = sinon.create(callProto);
- proxyCall.proxy = spy;
- proxyCall.thisValue = thisValue;
- proxyCall.args = args;
- proxyCall.returnValue = returnValue;
- proxyCall.exception = exception;
- proxyCall.callId = id;
-
- return proxyCall;
- }
- createSpyCall.toString = callProto.toString; // used by mocks
-
- sinon.spyCall = createSpyCall;
- return createSpyCall;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- require("./match");
- require("./format");
- module.exports = makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend times_in_words.js
- * @depend util/core.js
- * @depend extend.js
- * @depend call.js
- * @depend format.js
- */
-/**
- * Spy functions
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function (sinon) {
-
- function makeApi(sinon) {
- var push = Array.prototype.push;
- var slice = Array.prototype.slice;
- var callId = 0;
-
- function spy(object, property, types) {
- if (!property && typeof object == "function") {
- return spy.create(object);
- }
-
- if (!object && !property) {
- return spy.create(function () { });
- }
-
- if (types) {
- var methodDesc = sinon.getPropertyDescriptor(object, property);
- for (var i = 0; i < types.length; i++) {
- methodDesc[types[i]] = spy.create(methodDesc[types[i]]);
- }
- return sinon.wrapMethod(object, property, methodDesc);
- } else {
- var method = object[property];
- return sinon.wrapMethod(object, property, spy.create(method));
- }
- }
-
- function matchingFake(fakes, args, strict) {
- if (!fakes) {
- return;
- }
-
- for (var i = 0, l = fakes.length; i < l; i++) {
- if (fakes[i].matches(args, strict)) {
- return fakes[i];
- }
- }
- }
-
- function incrementCallCount() {
- this.called = true;
- this.callCount += 1;
- this.notCalled = false;
- this.calledOnce = this.callCount == 1;
- this.calledTwice = this.callCount == 2;
- this.calledThrice = this.callCount == 3;
- }
-
- function createCallProperties() {
- this.firstCall = this.getCall(0);
- this.secondCall = this.getCall(1);
- this.thirdCall = this.getCall(2);
- this.lastCall = this.getCall(this.callCount - 1);
- }
-
- var vars = "a,b,c,d,e,f,g,h,i,j,k,l";
- function createProxy(func, proxyLength) {
- // Retain the function length:
- var p;
- if (proxyLength) {
- eval("p = (function proxy(" + vars.substring(0, proxyLength * 2 - 1) +
- ") { return p.invoke(func, this, slice.call(arguments)); });");
- } else {
- p = function proxy() {
- return p.invoke(func, this, slice.call(arguments));
- };
- }
- p.isSinonProxy = true;
- return p;
- }
-
- var uuid = 0;
-
- // Public API
- var spyApi = {
- reset: function () {
- if (this.invoking) {
- var err = new Error("Cannot reset Sinon function while invoking it. " +
- "Move the call to .reset outside of the callback.");
- err.name = "InvalidResetException";
- throw err;
- }
-
- this.called = false;
- this.notCalled = true;
- this.calledOnce = false;
- this.calledTwice = false;
- this.calledThrice = false;
- this.callCount = 0;
- this.firstCall = null;
- this.secondCall = null;
- this.thirdCall = null;
- this.lastCall = null;
- this.args = [];
- this.returnValues = [];
- this.thisValues = [];
- this.exceptions = [];
- this.callIds = [];
- if (this.fakes) {
- for (var i = 0; i < this.fakes.length; i++) {
- this.fakes[i].reset();
- }
- }
-
- return this;
- },
-
- create: function create(func, spyLength) {
- var name;
-
- if (typeof func != "function") {
- func = function () { };
- } else {
- name = sinon.functionName(func);
- }
-
- if (!spyLength) {
- spyLength = func.length;
- }
-
- var proxy = createProxy(func, spyLength);
-
- sinon.extend(proxy, spy);
- delete proxy.create;
- sinon.extend(proxy, func);
-
- proxy.reset();
- proxy.prototype = func.prototype;
- proxy.displayName = name || "spy";
- proxy.toString = sinon.functionToString;
- proxy.instantiateFake = sinon.spy.create;
- proxy.id = "spy#" + uuid++;
-
- return proxy;
- },
-
- invoke: function invoke(func, thisValue, args) {
- var matching = matchingFake(this.fakes, args);
- var exception, returnValue;
-
- incrementCallCount.call(this);
- push.call(this.thisValues, thisValue);
- push.call(this.args, args);
- push.call(this.callIds, callId++);
-
- // Make call properties available from within the spied function:
- createCallProperties.call(this);
-
- try {
- this.invoking = true;
-
- if (matching) {
- returnValue = matching.invoke(func, thisValue, args);
- } else {
- returnValue = (this.func || func).apply(thisValue, args);
- }
-
- var thisCall = this.getCall(this.callCount - 1);
- if (thisCall.calledWithNew() && typeof returnValue !== "object") {
- returnValue = thisValue;
- }
- } catch (e) {
- exception = e;
- } finally {
- delete this.invoking;
- }
-
- push.call(this.exceptions, exception);
- push.call(this.returnValues, returnValue);
-
- // Make return value and exception available in the calls:
- createCallProperties.call(this);
-
- if (exception !== undefined) {
- throw exception;
- }
-
- return returnValue;
- },
-
- named: function named(name) {
- this.displayName = name;
- return this;
- },
-
- getCall: function getCall(i) {
- if (i < 0 || i >= this.callCount) {
- return null;
- }
-
- return sinon.spyCall(this, this.thisValues[i], this.args[i],
- this.returnValues[i], this.exceptions[i],
- this.callIds[i]);
- },
-
- getCalls: function () {
- var calls = [];
- var i;
-
- for (i = 0; i < this.callCount; i++) {
- calls.push(this.getCall(i));
- }
-
- return calls;
- },
-
- calledBefore: function calledBefore(spyFn) {
- if (!this.called) {
- return false;
- }
-
- if (!spyFn.called) {
- return true;
- }
-
- return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1];
- },
-
- calledAfter: function calledAfter(spyFn) {
- if (!this.called || !spyFn.called) {
- return false;
- }
-
- return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1];
- },
-
- withArgs: function () {
- var args = slice.call(arguments);
-
- if (this.fakes) {
- var match = matchingFake(this.fakes, args, true);
-
- if (match) {
- return match;
- }
- } else {
- this.fakes = [];
- }
-
- var original = this;
- var fake = this.instantiateFake();
- fake.matchingAguments = args;
- fake.parent = this;
- push.call(this.fakes, fake);
-
- fake.withArgs = function () {
- return original.withArgs.apply(original, arguments);
- };
-
- for (var i = 0; i < this.args.length; i++) {
- if (fake.matches(this.args[i])) {
- incrementCallCount.call(fake);
- push.call(fake.thisValues, this.thisValues[i]);
- push.call(fake.args, this.args[i]);
- push.call(fake.returnValues, this.returnValues[i]);
- push.call(fake.exceptions, this.exceptions[i]);
- push.call(fake.callIds, this.callIds[i]);
- }
- }
- createCallProperties.call(fake);
-
- return fake;
- },
-
- matches: function (args, strict) {
- var margs = this.matchingAguments;
-
- if (margs.length <= args.length &&
- sinon.deepEqual(margs, args.slice(0, margs.length))) {
- return !strict || margs.length == args.length;
- }
- },
-
- printf: function (format) {
- var spy = this;
- var args = slice.call(arguments, 1);
- var formatter;
-
- return (format || "").replace(/%(.)/g, function (match, specifyer) {
- formatter = spyApi.formatters[specifyer];
-
- if (typeof formatter == "function") {
- return formatter.call(null, spy, args);
- } else if (!isNaN(parseInt(specifyer, 10))) {
- return sinon.format(args[specifyer - 1]);
- }
-
- return "%" + specifyer;
- });
- }
- };
-
- function delegateToCalls(method, matchAny, actual, notCalled) {
- spyApi[method] = function () {
- if (!this.called) {
- if (notCalled) {
- return notCalled.apply(this, arguments);
- }
- return false;
- }
-
- var currentCall;
- var matches = 0;
-
- for (var i = 0, l = this.callCount; i < l; i += 1) {
- currentCall = this.getCall(i);
-
- if (currentCall[actual || method].apply(currentCall, arguments)) {
- matches += 1;
-
- if (matchAny) {
- return true;
- }
- }
- }
-
- return matches === this.callCount;
- };
- }
-
- delegateToCalls("calledOn", true);
- delegateToCalls("alwaysCalledOn", false, "calledOn");
- delegateToCalls("calledWith", true);
- delegateToCalls("calledWithMatch", true);
- delegateToCalls("alwaysCalledWith", false, "calledWith");
- delegateToCalls("alwaysCalledWithMatch", false, "calledWithMatch");
- delegateToCalls("calledWithExactly", true);
- delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly");
- delegateToCalls("neverCalledWith", false, "notCalledWith", function () {
- return true;
- });
- delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch", function () {
- return true;
- });
- delegateToCalls("threw", true);
- delegateToCalls("alwaysThrew", false, "threw");
- delegateToCalls("returned", true);
- delegateToCalls("alwaysReturned", false, "returned");
- delegateToCalls("calledWithNew", true);
- delegateToCalls("alwaysCalledWithNew", false, "calledWithNew");
- delegateToCalls("callArg", false, "callArgWith", function () {
- throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
- });
- spyApi.callArgWith = spyApi.callArg;
- delegateToCalls("callArgOn", false, "callArgOnWith", function () {
- throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
- });
- spyApi.callArgOnWith = spyApi.callArgOn;
- delegateToCalls("yield", false, "yield", function () {
- throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
- });
- // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode.
- spyApi.invokeCallback = spyApi.yield;
- delegateToCalls("yieldOn", false, "yieldOn", function () {
- throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
- });
- delegateToCalls("yieldTo", false, "yieldTo", function (property) {
- throw new Error(this.toString() + " cannot yield to '" + property +
- "' since it was not yet invoked.");
- });
- delegateToCalls("yieldToOn", false, "yieldToOn", function (property) {
- throw new Error(this.toString() + " cannot yield to '" + property +
- "' since it was not yet invoked.");
- });
-
- spyApi.formatters = {
- c: function (spy) {
- return sinon.timesInWords(spy.callCount);
- },
-
- n: function (spy) {
- return spy.toString();
- },
-
- C: function (spy) {
- var calls = [];
-
- for (var i = 0, l = spy.callCount; i < l; ++i) {
- var stringifiedCall = " " + spy.getCall(i).toString();
- if (/\n/.test(calls[i - 1])) {
- stringifiedCall = "\n" + stringifiedCall;
- }
- push.call(calls, stringifiedCall);
- }
-
- return calls.length > 0 ? "\n" + calls.join("\n") : "";
- },
-
- t: function (spy) {
- var objects = [];
-
- for (var i = 0, l = spy.callCount; i < l; ++i) {
- push.call(objects, sinon.format(spy.thisValues[i]));
- }
-
- return objects.join(", ");
- },
-
- "*": function (spy, args) {
- var formatted = [];
-
- for (var i = 0, l = args.length; i < l; ++i) {
- push.call(formatted, sinon.format(args[i]));
- }
-
- return formatted.join(", ");
- }
- };
-
- sinon.extend(spy, spyApi);
-
- spy.spyCall = sinon.spyCall;
- sinon.spy = spy;
-
- return spy;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- require("./call");
- require("./extend");
- require("./times_in_words");
- require("./format");
- module.exports = makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend util/core.js
- * @depend extend.js
- */
-/**
- * Stub behavior
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @author Tim Fischbach (mail@timfischbach.de)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function (sinon) {
- var slice = Array.prototype.slice;
- var join = Array.prototype.join;
- var useLeftMostCallback = -1;
- var useRightMostCallback = -2;
-
- var nextTick = (function () {
- if (typeof process === "object" && typeof process.nextTick === "function") {
- return process.nextTick;
- } else if (typeof setImmediate === "function") {
- return setImmediate;
- } else {
- return function (callback) {
- setTimeout(callback, 0);
- };
- }
- })();
-
- function throwsException(error, message) {
- if (typeof error == "string") {
- this.exception = new Error(message || "");
- this.exception.name = error;
- } else if (!error) {
- this.exception = new Error("Error");
- } else {
- this.exception = error;
- }
-
- return this;
- }
-
- function getCallback(behavior, args) {
- var callArgAt = behavior.callArgAt;
-
- if (callArgAt >= 0) {
- return args[callArgAt];
- }
-
- var argumentList;
-
- if (callArgAt === useLeftMostCallback) {
- argumentList = args;
- }
-
- if (callArgAt === useRightMostCallback) {
- argumentList = slice.call(args).reverse();
- }
-
- var callArgProp = behavior.callArgProp;
-
- for (var i = 0, l = argumentList.length; i < l; ++i) {
- if (!callArgProp && typeof argumentList[i] == "function") {
- return argumentList[i];
- }
-
- if (callArgProp && argumentList[i] &&
- typeof argumentList[i][callArgProp] == "function") {
- return argumentList[i][callArgProp];
- }
- }
-
- return null;
- }
-
- function makeApi(sinon) {
- function getCallbackError(behavior, func, args) {
- if (behavior.callArgAt < 0) {
- var msg;
-
- if (behavior.callArgProp) {
- msg = sinon.functionName(behavior.stub) +
- " expected to yield to '" + behavior.callArgProp +
- "', but no object with such a property was passed.";
- } else {
- msg = sinon.functionName(behavior.stub) +
- " expected to yield, but no callback was passed.";
- }
-
- if (args.length > 0) {
- msg += " Received [" + join.call(args, ", ") + "]";
- }
-
- return msg;
- }
-
- return "argument at index " + behavior.callArgAt + " is not a function: " + func;
- }
-
- function callCallback(behavior, args) {
- if (typeof behavior.callArgAt == "number") {
- var func = getCallback(behavior, args);
-
- if (typeof func != "function") {
- throw new TypeError(getCallbackError(behavior, func, args));
- }
-
- if (behavior.callbackAsync) {
- nextTick(function () {
- func.apply(behavior.callbackContext, behavior.callbackArguments);
- });
- } else {
- func.apply(behavior.callbackContext, behavior.callbackArguments);
- }
- }
- }
-
- var proto = {
- create: function create(stub) {
- var behavior = sinon.extend({}, sinon.behavior);
- delete behavior.create;
- behavior.stub = stub;
-
- return behavior;
- },
-
- isPresent: function isPresent() {
- return (typeof this.callArgAt == "number" ||
- this.exception ||
- typeof this.returnArgAt == "number" ||
- this.returnThis ||
- this.returnValueDefined);
- },
-
- invoke: function invoke(context, args) {
- callCallback(this, args);
-
- if (this.exception) {
- throw this.exception;
- } else if (typeof this.returnArgAt == "number") {
- return args[this.returnArgAt];
- } else if (this.returnThis) {
- return context;
- }
-
- return this.returnValue;
- },
-
- onCall: function onCall(index) {
- return this.stub.onCall(index);
- },
-
- onFirstCall: function onFirstCall() {
- return this.stub.onFirstCall();
- },
-
- onSecondCall: function onSecondCall() {
- return this.stub.onSecondCall();
- },
-
- onThirdCall: function onThirdCall() {
- return this.stub.onThirdCall();
- },
-
- withArgs: function withArgs(/* arguments */) {
- throw new Error("Defining a stub by invoking \"stub.onCall(...).withArgs(...)\" is not supported. " +
- "Use \"stub.withArgs(...).onCall(...)\" to define sequential behavior for calls with certain arguments.");
- },
-
- callsArg: function callsArg(pos) {
- if (typeof pos != "number") {
- throw new TypeError("argument index is not number");
- }
-
- this.callArgAt = pos;
- this.callbackArguments = [];
- this.callbackContext = undefined;
- this.callArgProp = undefined;
- this.callbackAsync = false;
-
- return this;
- },
-
- callsArgOn: function callsArgOn(pos, context) {
- if (typeof pos != "number") {
- throw new TypeError("argument index is not number");
- }
- if (typeof context != "object") {
- throw new TypeError("argument context is not an object");
- }
-
- this.callArgAt = pos;
- this.callbackArguments = [];
- this.callbackContext = context;
- this.callArgProp = undefined;
- this.callbackAsync = false;
-
- return this;
- },
-
- callsArgWith: function callsArgWith(pos) {
- if (typeof pos != "number") {
- throw new TypeError("argument index is not number");
- }
-
- this.callArgAt = pos;
- this.callbackArguments = slice.call(arguments, 1);
- this.callbackContext = undefined;
- this.callArgProp = undefined;
- this.callbackAsync = false;
-
- return this;
- },
-
- callsArgOnWith: function callsArgWith(pos, context) {
- if (typeof pos != "number") {
- throw new TypeError("argument index is not number");
- }
- if (typeof context != "object") {
- throw new TypeError("argument context is not an object");
- }
-
- this.callArgAt = pos;
- this.callbackArguments = slice.call(arguments, 2);
- this.callbackContext = context;
- this.callArgProp = undefined;
- this.callbackAsync = false;
-
- return this;
- },
-
- yields: function () {
- this.callArgAt = useLeftMostCallback;
- this.callbackArguments = slice.call(arguments, 0);
- this.callbackContext = undefined;
- this.callArgProp = undefined;
- this.callbackAsync = false;
-
- return this;
- },
-
- yieldsRight: function () {
- this.callArgAt = useRightMostCallback;
- this.callbackArguments = slice.call(arguments, 0);
- this.callbackContext = undefined;
- this.callArgProp = undefined;
- this.callbackAsync = false;
-
- return this;
- },
-
- yieldsOn: function (context) {
- if (typeof context != "object") {
- throw new TypeError("argument context is not an object");
- }
-
- this.callArgAt = useLeftMostCallback;
- this.callbackArguments = slice.call(arguments, 1);
- this.callbackContext = context;
- this.callArgProp = undefined;
- this.callbackAsync = false;
-
- return this;
- },
-
- yieldsTo: function (prop) {
- this.callArgAt = useLeftMostCallback;
- this.callbackArguments = slice.call(arguments, 1);
- this.callbackContext = undefined;
- this.callArgProp = prop;
- this.callbackAsync = false;
-
- return this;
- },
-
- yieldsToOn: function (prop, context) {
- if (typeof context != "object") {
- throw new TypeError("argument context is not an object");
- }
-
- this.callArgAt = useLeftMostCallback;
- this.callbackArguments = slice.call(arguments, 2);
- this.callbackContext = context;
- this.callArgProp = prop;
- this.callbackAsync = false;
-
- return this;
- },
-
- throws: throwsException,
- throwsException: throwsException,
-
- returns: function returns(value) {
- this.returnValue = value;
- this.returnValueDefined = true;
-
- return this;
- },
-
- returnsArg: function returnsArg(pos) {
- if (typeof pos != "number") {
- throw new TypeError("argument index is not number");
- }
-
- this.returnArgAt = pos;
-
- return this;
- },
-
- returnsThis: function returnsThis() {
- this.returnThis = true;
-
- return this;
- }
- };
-
- // create asynchronous versions of callsArg* and yields* methods
- for (var method in proto) {
- // need to avoid creating anotherasync versions of the newly added async methods
- if (proto.hasOwnProperty(method) &&
- method.match(/^(callsArg|yields)/) &&
- !method.match(/Async/)) {
- proto[method + "Async"] = (function (syncFnName) {
- return function () {
- var result = this[syncFnName].apply(this, arguments);
- this.callbackAsync = true;
- return result;
- };
- })(method);
- }
- }
-
- sinon.behavior = proto;
- return proto;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- require("./extend");
- module.exports = makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend util/core.js
- * @depend extend.js
- * @depend spy.js
- * @depend behavior.js
- */
-/**
- * Stub functions
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function (sinon) {
- function makeApi(sinon) {
- function stub(object, property, func) {
- if (!!func && typeof func != "function" && typeof func != "object") {
- throw new TypeError("Custom stub should be a function or a property descriptor");
- }
-
- var wrapper;
-
- if (func) {
- if (typeof func == "function") {
- wrapper = sinon.spy && sinon.spy.create ? sinon.spy.create(func) : func;
- } else {
- wrapper = func;
- if (sinon.spy && sinon.spy.create) {
- var types = sinon.objectKeys(wrapper);
- for (var i = 0; i < types.length; i++) {
- wrapper[types[i]] = sinon.spy.create(wrapper[types[i]]);
- }
- }
- }
- } else {
- var stubLength = 0;
- if (typeof object == "object" && typeof object[property] == "function") {
- stubLength = object[property].length;
- }
- wrapper = stub.create(stubLength);
- }
-
- if (!object && typeof property === "undefined") {
- return sinon.stub.create();
- }
-
- if (typeof property === "undefined" && typeof object == "object") {
- for (var prop in object) {
- if (typeof sinon.getPropertyDescriptor(object, prop).value === "function") {
- stub(object, prop);
- }
- }
-
- return object;
- }
-
- return sinon.wrapMethod(object, property, wrapper);
- }
-
- function getDefaultBehavior(stub) {
- return stub.defaultBehavior || getParentBehaviour(stub) || sinon.behavior.create(stub);
- }
-
- function getParentBehaviour(stub) {
- return (stub.parent && getCurrentBehavior(stub.parent));
- }
-
- function getCurrentBehavior(stub) {
- var behavior = stub.behaviors[stub.callCount - 1];
- return behavior && behavior.isPresent() ? behavior : getDefaultBehavior(stub);
- }
-
- var uuid = 0;
-
- var proto = {
- create: function create(stubLength) {
- var functionStub = function () {
- return getCurrentBehavior(functionStub).invoke(this, arguments);
- };
-
- functionStub.id = "stub#" + uuid++;
- var orig = functionStub;
- functionStub = sinon.spy.create(functionStub, stubLength);
- functionStub.func = orig;
-
- sinon.extend(functionStub, stub);
- functionStub.instantiateFake = sinon.stub.create;
- functionStub.displayName = "stub";
- functionStub.toString = sinon.functionToString;
-
- functionStub.defaultBehavior = null;
- functionStub.behaviors = [];
-
- return functionStub;
- },
-
- resetBehavior: function () {
- var i;
-
- this.defaultBehavior = null;
- this.behaviors = [];
-
- delete this.returnValue;
- delete this.returnArgAt;
- this.returnThis = false;
-
- if (this.fakes) {
- for (i = 0; i < this.fakes.length; i++) {
- this.fakes[i].resetBehavior();
- }
- }
- },
-
- onCall: function onCall(index) {
- if (!this.behaviors[index]) {
- this.behaviors[index] = sinon.behavior.create(this);
- }
-
- return this.behaviors[index];
- },
-
- onFirstCall: function onFirstCall() {
- return this.onCall(0);
- },
-
- onSecondCall: function onSecondCall() {
- return this.onCall(1);
- },
-
- onThirdCall: function onThirdCall() {
- return this.onCall(2);
- }
- };
-
- for (var method in sinon.behavior) {
- if (sinon.behavior.hasOwnProperty(method) &&
- !proto.hasOwnProperty(method) &&
- method != "create" &&
- method != "withArgs" &&
- method != "invoke") {
- proto[method] = (function (behaviorMethod) {
- return function () {
- this.defaultBehavior = this.defaultBehavior || sinon.behavior.create(this);
- this.defaultBehavior[behaviorMethod].apply(this.defaultBehavior, arguments);
- return this;
- };
- }(method));
- }
- }
-
- sinon.extend(stub, proto);
- sinon.stub = stub;
-
- return stub;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- require("./behavior");
- require("./spy");
- require("./extend");
- module.exports = makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend times_in_words.js
- * @depend util/core.js
- * @depend call.js
- * @depend extend.js
- * @depend match.js
- * @depend spy.js
- * @depend stub.js
- * @depend format.js
- */
-/**
- * Mock functions.
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function (sinon) {
- function makeApi(sinon) {
- var push = [].push;
- var match = sinon.match;
-
- function mock(object) {
- if (typeof console !== undefined && console.warn) {
- console.warn("mock will be removed from Sinon.JS v2.0");
- }
-
- if (!object) {
- return sinon.expectation.create("Anonymous mock");
- }
-
- return mock.create(object);
- }
-
- function each(collection, callback) {
- if (!collection) {
- return;
- }
-
- for (var i = 0, l = collection.length; i < l; i += 1) {
- callback(collection[i]);
- }
- }
-
- sinon.extend(mock, {
- create: function create(object) {
- if (!object) {
- throw new TypeError("object is null");
- }
-
- var mockObject = sinon.extend({}, mock);
- mockObject.object = object;
- delete mockObject.create;
-
- return mockObject;
- },
-
- expects: function expects(method) {
- if (!method) {
- throw new TypeError("method is falsy");
- }
-
- if (!this.expectations) {
- this.expectations = {};
- this.proxies = [];
- }
-
- if (!this.expectations[method]) {
- this.expectations[method] = [];
- var mockObject = this;
-
- sinon.wrapMethod(this.object, method, function () {
- return mockObject.invokeMethod(method, this, arguments);
- });
-
- push.call(this.proxies, method);
- }
-
- var expectation = sinon.expectation.create(method);
- push.call(this.expectations[method], expectation);
-
- return expectation;
- },
-
- restore: function restore() {
- var object = this.object;
-
- each(this.proxies, function (proxy) {
- if (typeof object[proxy].restore == "function") {
- object[proxy].restore();
- }
- });
- },
-
- verify: function verify() {
- var expectations = this.expectations || {};
- var messages = [], met = [];
-
- each(this.proxies, function (proxy) {
- each(expectations[proxy], function (expectation) {
- if (!expectation.met()) {
- push.call(messages, expectation.toString());
- } else {
- push.call(met, expectation.toString());
- }
- });
- });
-
- this.restore();
-
- if (messages.length > 0) {
- sinon.expectation.fail(messages.concat(met).join("\n"));
- } else if (met.length > 0) {
- sinon.expectation.pass(messages.concat(met).join("\n"));
- }
-
- return true;
- },
-
- invokeMethod: function invokeMethod(method, thisValue, args) {
- var expectations = this.expectations && this.expectations[method];
- var length = expectations && expectations.length || 0, i;
-
- for (i = 0; i < length; i += 1) {
- if (!expectations[i].met() &&
- expectations[i].allowsCall(thisValue, args)) {
- return expectations[i].apply(thisValue, args);
- }
- }
-
- var messages = [], available, exhausted = 0;
-
- for (i = 0; i < length; i += 1) {
- if (expectations[i].allowsCall(thisValue, args)) {
- available = available || expectations[i];
- } else {
- exhausted += 1;
- }
- push.call(messages, " " + expectations[i].toString());
- }
-
- if (exhausted === 0) {
- return available.apply(thisValue, args);
- }
-
- messages.unshift("Unexpected call: " + sinon.spyCall.toString.call({
- proxy: method,
- args: args
- }));
-
- sinon.expectation.fail(messages.join("\n"));
- }
- });
-
- var times = sinon.timesInWords;
- var slice = Array.prototype.slice;
-
- function callCountInWords(callCount) {
- if (callCount == 0) {
- return "never called";
- } else {
- return "called " + times(callCount);
- }
- }
-
- function expectedCallCountInWords(expectation) {
- var min = expectation.minCalls;
- var max = expectation.maxCalls;
-
- if (typeof min == "number" && typeof max == "number") {
- var str = times(min);
-
- if (min != max) {
- str = "at least " + str + " and at most " + times(max);
- }
-
- return str;
- }
-
- if (typeof min == "number") {
- return "at least " + times(min);
- }
-
- return "at most " + times(max);
- }
-
- function receivedMinCalls(expectation) {
- var hasMinLimit = typeof expectation.minCalls == "number";
- return !hasMinLimit || expectation.callCount >= expectation.minCalls;
- }
-
- function receivedMaxCalls(expectation) {
- if (typeof expectation.maxCalls != "number") {
- return false;
- }
-
- return expectation.callCount == expectation.maxCalls;
- }
-
- function verifyMatcher(possibleMatcher, arg) {
- if (match && match.isMatcher(possibleMatcher)) {
- return possibleMatcher.test(arg);
- } else {
- return true;
- }
- }
-
- sinon.expectation = {
- minCalls: 1,
- maxCalls: 1,
-
- create: function create(methodName) {
- var expectation = sinon.extend(sinon.stub.create(), sinon.expectation);
- delete expectation.create;
- expectation.method = methodName;
-
- return expectation;
- },
-
- invoke: function invoke(func, thisValue, args) {
- this.verifyCallAllowed(thisValue, args);
-
- return sinon.spy.invoke.apply(this, arguments);
- },
-
- atLeast: function atLeast(num) {
- if (typeof num != "number") {
- throw new TypeError("'" + num + "' is not number");
- }
-
- if (!this.limitsSet) {
- this.maxCalls = null;
- this.limitsSet = true;
- }
-
- this.minCalls = num;
-
- return this;
- },
-
- atMost: function atMost(num) {
- if (typeof num != "number") {
- throw new TypeError("'" + num + "' is not number");
- }
-
- if (!this.limitsSet) {
- this.minCalls = null;
- this.limitsSet = true;
- }
-
- this.maxCalls = num;
-
- return this;
- },
-
- never: function never() {
- return this.exactly(0);
- },
-
- once: function once() {
- return this.exactly(1);
- },
-
- twice: function twice() {
- return this.exactly(2);
- },
-
- thrice: function thrice() {
- return this.exactly(3);
- },
-
- exactly: function exactly(num) {
- if (typeof num != "number") {
- throw new TypeError("'" + num + "' is not a number");
- }
-
- this.atLeast(num);
- return this.atMost(num);
- },
-
- met: function met() {
- return !this.failed && receivedMinCalls(this);
- },
-
- verifyCallAllowed: function verifyCallAllowed(thisValue, args) {
- if (receivedMaxCalls(this)) {
- this.failed = true;
- sinon.expectation.fail(this.method + " already called " + times(this.maxCalls));
- }
-
- if ("expectedThis" in this && this.expectedThis !== thisValue) {
- sinon.expectation.fail(this.method + " called with " + thisValue + " as thisValue, expected " +
- this.expectedThis);
- }
-
- if (!("expectedArguments" in this)) {
- return;
- }
-
- if (!args) {
- sinon.expectation.fail(this.method + " received no arguments, expected " +
- sinon.format(this.expectedArguments));
- }
-
- if (args.length < this.expectedArguments.length) {
- sinon.expectation.fail(this.method + " received too few arguments (" + sinon.format(args) +
- "), expected " + sinon.format(this.expectedArguments));
- }
-
- if (this.expectsExactArgCount &&
- args.length != this.expectedArguments.length) {
- sinon.expectation.fail(this.method + " received too many arguments (" + sinon.format(args) +
- "), expected " + sinon.format(this.expectedArguments));
- }
-
- for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) {
-
- if (!verifyMatcher(this.expectedArguments[i], args[i])) {
- sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) +
- ", didn't match " + this.expectedArguments.toString());
- }
-
- if (!sinon.deepEqual(this.expectedArguments[i], args[i])) {
- sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) +
- ", expected " + sinon.format(this.expectedArguments));
- }
- }
- },
-
- allowsCall: function allowsCall(thisValue, args) {
- if (this.met() && receivedMaxCalls(this)) {
- return false;
- }
-
- if ("expectedThis" in this && this.expectedThis !== thisValue) {
- return false;
- }
-
- if (!("expectedArguments" in this)) {
- return true;
- }
-
- args = args || [];
-
- if (args.length < this.expectedArguments.length) {
- return false;
- }
-
- if (this.expectsExactArgCount &&
- args.length != this.expectedArguments.length) {
- return false;
- }
-
- for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) {
- if (!verifyMatcher(this.expectedArguments[i], args[i])) {
- return false;
- }
-
- if (!sinon.deepEqual(this.expectedArguments[i], args[i])) {
- return false;
- }
- }
-
- return true;
- },
-
- withArgs: function withArgs() {
- this.expectedArguments = slice.call(arguments);
- return this;
- },
-
- withExactArgs: function withExactArgs() {
- this.withArgs.apply(this, arguments);
- this.expectsExactArgCount = true;
- return this;
- },
-
- on: function on(thisValue) {
- this.expectedThis = thisValue;
- return this;
- },
-
- toString: function () {
- var args = (this.expectedArguments || []).slice();
-
- if (!this.expectsExactArgCount) {
- push.call(args, "[...]");
- }
-
- var callStr = sinon.spyCall.toString.call({
- proxy: this.method || "anonymous mock expectation",
- args: args
- });
-
- var message = callStr.replace(", [...", "[, ...") + " " +
- expectedCallCountInWords(this);
-
- if (this.met()) {
- return "Expectation met: " + message;
- }
-
- return "Expected " + message + " (" +
- callCountInWords(this.callCount) + ")";
- },
-
- verify: function verify() {
- if (!this.met()) {
- sinon.expectation.fail(this.toString());
- } else {
- sinon.expectation.pass(this.toString());
- }
-
- return true;
- },
-
- pass: function pass(message) {
- sinon.assert.pass(message);
- },
-
- fail: function fail(message) {
- var exception = new Error(message);
- exception.name = "ExpectationError";
-
- throw exception;
- }
- };
-
- sinon.mock = mock;
- return mock;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- require("./times_in_words");
- require("./call");
- require("./extend");
- require("./match");
- require("./spy");
- require("./stub");
- require("./format");
-
- module.exports = makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend util/core.js
- * @depend spy.js
- * @depend stub.js
- * @depend mock.js
- */
-/**
- * Collections of stubs, spies and mocks.
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function (sinon) {
- var push = [].push;
- var hasOwnProperty = Object.prototype.hasOwnProperty;
-
- function getFakes(fakeCollection) {
- if (!fakeCollection.fakes) {
- fakeCollection.fakes = [];
- }
-
- return fakeCollection.fakes;
- }
-
- function each(fakeCollection, method) {
- var fakes = getFakes(fakeCollection);
-
- for (var i = 0, l = fakes.length; i < l; i += 1) {
- if (typeof fakes[i][method] == "function") {
- fakes[i][method]();
- }
- }
- }
-
- function compact(fakeCollection) {
- var fakes = getFakes(fakeCollection);
- var i = 0;
- while (i < fakes.length) {
- fakes.splice(i, 1);
- }
- }
-
- function makeApi(sinon) {
- var collection = {
- verify: function resolve() {
- each(this, "verify");
- },
-
- restore: function restore() {
- each(this, "restore");
- compact(this);
- },
-
- reset: function restore() {
- each(this, "reset");
- },
-
- verifyAndRestore: function verifyAndRestore() {
- var exception;
-
- try {
- this.verify();
- } catch (e) {
- exception = e;
- }
-
- this.restore();
-
- if (exception) {
- throw exception;
- }
- },
-
- add: function add(fake) {
- push.call(getFakes(this), fake);
- return fake;
- },
-
- spy: function spy() {
- return this.add(sinon.spy.apply(sinon, arguments));
- },
-
- stub: function stub(object, property, value) {
- if (property) {
- var original = object[property];
-
- if (typeof original != "function") {
- if (!hasOwnProperty.call(object, property)) {
- throw new TypeError("Cannot stub non-existent own property " + property);
- }
-
- object[property] = value;
-
- return this.add({
- restore: function () {
- object[property] = original;
- }
- });
- }
- }
- if (!property && !!object && typeof object == "object") {
- var stubbedObj = sinon.stub.apply(sinon, arguments);
-
- for (var prop in stubbedObj) {
- if (typeof stubbedObj[prop] === "function") {
- this.add(stubbedObj[prop]);
- }
- }
-
- return stubbedObj;
- }
-
- return this.add(sinon.stub.apply(sinon, arguments));
- },
-
- mock: function mock() {
- return this.add(sinon.mock.apply(sinon, arguments));
- },
-
- inject: function inject(obj) {
- var col = this;
-
- obj.spy = function () {
- return col.spy.apply(col, arguments);
- };
-
- obj.stub = function () {
- return col.stub.apply(col, arguments);
- };
-
- obj.mock = function () {
- return col.mock.apply(col, arguments);
- };
-
- return obj;
- }
- };
-
- sinon.collection = collection;
- return collection;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- require("./mock");
- require("./spy");
- require("./stub");
- module.exports = makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/*global lolex */
-
-/**
- * Fake timer API
- * setTimeout
- * setInterval
- * clearTimeout
- * clearInterval
- * tick
- * reset
- * Date
- *
- * Inspired by jsUnitMockTimeOut from JsUnit
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-if (typeof sinon == "undefined") {
- var sinon = {};
-}
-
-(function (global) {
- function makeApi(sinon, lol) {
- var llx = typeof lolex !== "undefined" ? lolex : lol;
-
- sinon.useFakeTimers = function () {
- var now, methods = Array.prototype.slice.call(arguments);
-
- if (typeof methods[0] === "string") {
- now = 0;
- } else {
- now = methods.shift();
- }
-
- var clock = llx.install(now || 0, methods);
- clock.restore = clock.uninstall;
- return clock;
- };
-
- sinon.clock = {
- create: function (now) {
- return llx.createClock(now);
- }
- };
-
- sinon.timers = {
- setTimeout: setTimeout,
- clearTimeout: clearTimeout,
- setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined),
- clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate : undefined),
- setInterval: setInterval,
- clearInterval: clearInterval,
- Date: Date
- };
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, epxorts, module, lolex) {
- var sinon = require("./core");
- makeApi(sinon, lolex);
- module.exports = sinon;
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module, require("lolex"));
- } else {
- makeApi(sinon);
- }
-}(typeof global != "undefined" && typeof global !== "function" ? global : this));
-
-/**
- * Minimal Event interface implementation
- *
- * Original implementation by Sven Fuchs: https://gist.github.com/995028
- * Modifications and tests by Christian Johansen.
- *
- * @author Sven Fuchs (svenfuchs@artweb-design.de)
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2011 Sven Fuchs, Christian Johansen
- */
-
-if (typeof sinon == "undefined") {
- this.sinon = {};
-}
-
-(function () {
- var push = [].push;
-
- function makeApi(sinon) {
- sinon.Event = function Event(type, bubbles, cancelable, target) {
- this.initEvent(type, bubbles, cancelable, target);
- };
-
- sinon.Event.prototype = {
- initEvent: function (type, bubbles, cancelable, target) {
- this.type = type;
- this.bubbles = bubbles;
- this.cancelable = cancelable;
- this.target = target;
- },
-
- stopPropagation: function () {},
-
- preventDefault: function () {
- this.defaultPrevented = true;
- }
- };
-
- sinon.ProgressEvent = function ProgressEvent(type, progressEventRaw, target) {
- this.initEvent(type, false, false, target);
- this.loaded = progressEventRaw.loaded || null;
- this.total = progressEventRaw.total || null;
- this.lengthComputable = !!progressEventRaw.total;
- };
-
- sinon.ProgressEvent.prototype = new sinon.Event();
-
- sinon.ProgressEvent.prototype.constructor = sinon.ProgressEvent;
-
- sinon.CustomEvent = function CustomEvent(type, customData, target) {
- this.initEvent(type, false, false, target);
- this.detail = customData.detail || null;
- };
-
- sinon.CustomEvent.prototype = new sinon.Event();
-
- sinon.CustomEvent.prototype.constructor = sinon.CustomEvent;
-
- sinon.EventTarget = {
- addEventListener: function addEventListener(event, listener) {
- this.eventListeners = this.eventListeners || {};
- this.eventListeners[event] = this.eventListeners[event] || [];
- push.call(this.eventListeners[event], listener);
- },
-
- removeEventListener: function removeEventListener(event, listener) {
- var listeners = this.eventListeners && this.eventListeners[event] || [];
-
- for (var i = 0, l = listeners.length; i < l; ++i) {
- if (listeners[i] == listener) {
- return listeners.splice(i, 1);
- }
- }
- },
-
- dispatchEvent: function dispatchEvent(event) {
- var type = event.type;
- var listeners = this.eventListeners && this.eventListeners[type] || [];
-
- for (var i = 0; i < listeners.length; i++) {
- if (typeof listeners[i] == "function") {
- listeners[i].call(this, event);
- } else {
- listeners[i].handleEvent(event);
- }
- }
-
- return !!event.defaultPrevented;
- }
- };
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require) {
- var sinon = require("./core");
- makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require);
- } else {
- makeApi(sinon);
- }
-}());
-
-/**
- * @depend util/core.js
- */
-/**
- * Logs errors
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2014 Christian Johansen
- */
-
-(function (sinon) {
- // cache a reference to setTimeout, so that our reference won't be stubbed out
- // when using fake timers and errors will still get logged
- // https://github.com/cjohansen/Sinon.JS/issues/381
- var realSetTimeout = setTimeout;
-
- function makeApi(sinon) {
-
- function log() {}
-
- function logError(label, err) {
- var msg = label + " threw exception: ";
-
- sinon.log(msg + "[" + err.name + "] " + err.message);
-
- if (err.stack) {
- sinon.log(err.stack);
- }
-
- logError.setTimeout(function () {
- err.message = msg + err.message;
- throw err;
- }, 0);
- };
-
- // wrap realSetTimeout with something we can stub in tests
- logError.setTimeout = function (func, timeout) {
- realSetTimeout(func, timeout);
- }
-
- var exports = {};
- exports.log = sinon.log = log;
- exports.logError = sinon.logError = logError;
-
- return exports;
- }
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- module.exports = makeApi(sinon);
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend core.js
- * @depend ../extend.js
- * @depend event.js
- * @depend ../log_error.js
- */
-/**
- * Fake XDomainRequest object
- */
-
-if (typeof sinon == "undefined") {
- this.sinon = {};
-}
-
-// wrapper for global
-(function (global) {
- var xdr = { XDomainRequest: global.XDomainRequest };
- xdr.GlobalXDomainRequest = global.XDomainRequest;
- xdr.supportsXDR = typeof xdr.GlobalXDomainRequest != "undefined";
- xdr.workingXDR = xdr.supportsXDR ? xdr.GlobalXDomainRequest : false;
-
- function makeApi(sinon) {
- sinon.xdr = xdr;
-
- function FakeXDomainRequest() {
- this.readyState = FakeXDomainRequest.UNSENT;
- this.requestBody = null;
- this.requestHeaders = {};
- this.status = 0;
- this.timeout = null;
-
- if (typeof FakeXDomainRequest.onCreate == "function") {
- FakeXDomainRequest.onCreate(this);
- }
- }
-
- function verifyState(xdr) {
- if (xdr.readyState !== FakeXDomainRequest.OPENED) {
- throw new Error("INVALID_STATE_ERR");
- }
-
- if (xdr.sendFlag) {
- throw new Error("INVALID_STATE_ERR");
- }
- }
-
- function verifyRequestSent(xdr) {
- if (xdr.readyState == FakeXDomainRequest.UNSENT) {
- throw new Error("Request not sent");
- }
- if (xdr.readyState == FakeXDomainRequest.DONE) {
- throw new Error("Request done");
- }
- }
-
- function verifyResponseBodyType(body) {
- if (typeof body != "string") {
- var error = new Error("Attempted to respond to fake XDomainRequest with " +
- body + ", which is not a string.");
- error.name = "InvalidBodyException";
- throw error;
- }
- }
-
- sinon.extend(FakeXDomainRequest.prototype, sinon.EventTarget, {
- open: function open(method, url) {
- this.method = method;
- this.url = url;
-
- this.responseText = null;
- this.sendFlag = false;
-
- this.readyStateChange(FakeXDomainRequest.OPENED);
- },
-
- readyStateChange: function readyStateChange(state) {
- this.readyState = state;
- var eventName = "";
- switch (this.readyState) {
- case FakeXDomainRequest.UNSENT:
- break;
- case FakeXDomainRequest.OPENED:
- break;
- case FakeXDomainRequest.LOADING:
- if (this.sendFlag) {
- //raise the progress event
- eventName = "onprogress";
- }
- break;
- case FakeXDomainRequest.DONE:
- if (this.isTimeout) {
- eventName = "ontimeout"
- } else if (this.errorFlag || (this.status < 200 || this.status > 299)) {
- eventName = "onerror";
- } else {
- eventName = "onload"
- }
- break;
- }
-
- // raising event (if defined)
- if (eventName) {
- if (typeof this[eventName] == "function") {
- try {
- this[eventName]();
- } catch (e) {
- sinon.logError("Fake XHR " + eventName + " handler", e);
- }
- }
- }
- },
-
- send: function send(data) {
- verifyState(this);
-
- if (!/^(get|head)$/i.test(this.method)) {
- this.requestBody = data;
- }
- this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8";
-
- this.errorFlag = false;
- this.sendFlag = true;
- this.readyStateChange(FakeXDomainRequest.OPENED);
-
- if (typeof this.onSend == "function") {
- this.onSend(this);
- }
- },
-
- abort: function abort() {
- this.aborted = true;
- this.responseText = null;
- this.errorFlag = true;
-
- if (this.readyState > sinon.FakeXDomainRequest.UNSENT && this.sendFlag) {
- this.readyStateChange(sinon.FakeXDomainRequest.DONE);
- this.sendFlag = false;
- }
- },
-
- setResponseBody: function setResponseBody(body) {
- verifyRequestSent(this);
- verifyResponseBodyType(body);
-
- var chunkSize = this.chunkSize || 10;
- var index = 0;
- this.responseText = "";
-
- do {
- this.readyStateChange(FakeXDomainRequest.LOADING);
- this.responseText += body.substring(index, index + chunkSize);
- index += chunkSize;
- } while (index < body.length);
-
- this.readyStateChange(FakeXDomainRequest.DONE);
- },
-
- respond: function respond(status, contentType, body) {
- // content-type ignored, since XDomainRequest does not carry this
- // we keep the same syntax for respond(...) as for FakeXMLHttpRequest to ease
- // test integration across browsers
- this.status = typeof status == "number" ? status : 200;
- this.setResponseBody(body || "");
- },
-
- simulatetimeout: function simulatetimeout() {
- this.status = 0;
- this.isTimeout = true;
- // Access to this should actually throw an error
- this.responseText = undefined;
- this.readyStateChange(FakeXDomainRequest.DONE);
- }
- });
-
- sinon.extend(FakeXDomainRequest, {
- UNSENT: 0,
- OPENED: 1,
- LOADING: 3,
- DONE: 4
- });
-
- sinon.useFakeXDomainRequest = function useFakeXDomainRequest() {
- sinon.FakeXDomainRequest.restore = function restore(keepOnCreate) {
- if (xdr.supportsXDR) {
- global.XDomainRequest = xdr.GlobalXDomainRequest;
- }
-
- delete sinon.FakeXDomainRequest.restore;
-
- if (keepOnCreate !== true) {
- delete sinon.FakeXDomainRequest.onCreate;
- }
- };
- if (xdr.supportsXDR) {
- global.XDomainRequest = sinon.FakeXDomainRequest;
- }
- return sinon.FakeXDomainRequest;
- };
-
- sinon.FakeXDomainRequest = FakeXDomainRequest;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./core");
- require("../extend");
- require("./event");
- require("../log_error");
- makeApi(sinon);
- module.exports = sinon;
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else {
- makeApi(sinon);
- }
-})(typeof global !== "undefined" ? global : self);
-
-/**
- * @depend core.js
- * @depend ../extend.js
- * @depend event.js
- * @depend ../log_error.js
- */
-/**
- * Fake XMLHttpRequest object
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function (global) {
-
- var supportsProgress = typeof ProgressEvent !== "undefined";
- var supportsCustomEvent = typeof CustomEvent !== "undefined";
- var supportsFormData = typeof FormData !== "undefined";
- var sinonXhr = { XMLHttpRequest: global.XMLHttpRequest };
- sinonXhr.GlobalXMLHttpRequest = global.XMLHttpRequest;
- sinonXhr.GlobalActiveXObject = global.ActiveXObject;
- sinonXhr.supportsActiveX = typeof sinonXhr.GlobalActiveXObject != "undefined";
- sinonXhr.supportsXHR = typeof sinonXhr.GlobalXMLHttpRequest != "undefined";
- sinonXhr.workingXHR = sinonXhr.supportsXHR ? sinonXhr.GlobalXMLHttpRequest : sinonXhr.supportsActiveX
- ? function () {
- return new sinonXhr.GlobalActiveXObject("MSXML2.XMLHTTP.3.0")
- } : false;
- sinonXhr.supportsCORS = sinonXhr.supportsXHR && "withCredentials" in (new sinonXhr.GlobalXMLHttpRequest());
-
- /*jsl:ignore*/
- var unsafeHeaders = {
- "Accept-Charset": true,
- "Accept-Encoding": true,
- Connection: true,
- "Content-Length": true,
- Cookie: true,
- Cookie2: true,
- "Content-Transfer-Encoding": true,
- Date: true,
- Expect: true,
- Host: true,
- "Keep-Alive": true,
- Referer: true,
- TE: true,
- Trailer: true,
- "Transfer-Encoding": true,
- Upgrade: true,
- "User-Agent": true,
- Via: true
- };
- /*jsl:end*/
-
- function FakeXMLHttpRequest() {
- this.readyState = FakeXMLHttpRequest.UNSENT;
- this.requestHeaders = {};
- this.requestBody = null;
- this.status = 0;
- this.statusText = "";
- this.upload = new UploadProgress();
- if (sinonXhr.supportsCORS) {
- this.withCredentials = false;
- }
-
- var xhr = this;
- var events = ["loadstart", "load", "abort", "loadend"];
-
- function addEventListener(eventName) {
- xhr.addEventListener(eventName, function (event) {
- var listener = xhr["on" + eventName];
-
- if (listener && typeof listener == "function") {
- listener.call(this, event);
- }
- });
- }
-
- for (var i = events.length - 1; i >= 0; i--) {
- addEventListener(events[i]);
- }
-
- if (typeof FakeXMLHttpRequest.onCreate == "function") {
- FakeXMLHttpRequest.onCreate(this);
- }
- }
-
- // An upload object is created for each
- // FakeXMLHttpRequest and allows upload
- // events to be simulated using uploadProgress
- // and uploadError.
- function UploadProgress() {
- this.eventListeners = {
- progress: [],
- load: [],
- abort: [],
- error: []
- }
- }
-
- UploadProgress.prototype.addEventListener = function addEventListener(event, listener) {
- this.eventListeners[event].push(listener);
- };
-
- UploadProgress.prototype.removeEventListener = function removeEventListener(event, listener) {
- var listeners = this.eventListeners[event] || [];
-
- for (var i = 0, l = listeners.length; i < l; ++i) {
- if (listeners[i] == listener) {
- return listeners.splice(i, 1);
- }
- }
- };
-
- UploadProgress.prototype.dispatchEvent = function dispatchEvent(event) {
- var listeners = this.eventListeners[event.type] || [];
-
- for (var i = 0, listener; (listener = listeners[i]) != null; i++) {
- listener(event);
- }
- };
-
- function verifyState(xhr) {
- if (xhr.readyState !== FakeXMLHttpRequest.OPENED) {
- throw new Error("INVALID_STATE_ERR");
- }
-
- if (xhr.sendFlag) {
- throw new Error("INVALID_STATE_ERR");
- }
- }
-
- function getHeader(headers, header) {
- header = header.toLowerCase();
-
- for (var h in headers) {
- if (h.toLowerCase() == header) {
- return h;
- }
- }
-
- return null;
- }
-
- // filtering to enable a white-list version of Sinon FakeXhr,
- // where whitelisted requests are passed through to real XHR
- function each(collection, callback) {
- if (!collection) {
- return;
- }
-
- for (var i = 0, l = collection.length; i < l; i += 1) {
- callback(collection[i]);
- }
- }
- function some(collection, callback) {
- for (var index = 0; index < collection.length; index++) {
- if (callback(collection[index]) === true) {
- return true;
- }
- }
- return false;
- }
- // largest arity in XHR is 5 - XHR#open
- var apply = function (obj, method, args) {
- switch (args.length) {
- case 0: return obj[method]();
- case 1: return obj[method](args[0]);
- case 2: return obj[method](args[0], args[1]);
- case 3: return obj[method](args[0], args[1], args[2]);
- case 4: return obj[method](args[0], args[1], args[2], args[3]);
- case 5: return obj[method](args[0], args[1], args[2], args[3], args[4]);
- }
- };
-
- FakeXMLHttpRequest.filters = [];
- FakeXMLHttpRequest.addFilter = function addFilter(fn) {
- this.filters.push(fn)
- };
- var IE6Re = /MSIE 6/;
- FakeXMLHttpRequest.defake = function defake(fakeXhr, xhrArgs) {
- var xhr = new sinonXhr.workingXHR();
- each([
- "open",
- "setRequestHeader",
- "send",
- "abort",
- "getResponseHeader",
- "getAllResponseHeaders",
- "addEventListener",
- "overrideMimeType",
- "removeEventListener"
- ], function (method) {
- fakeXhr[method] = function () {
- return apply(xhr, method, arguments);
- };
- });
-
- var copyAttrs = function (args) {
- each(args, function (attr) {
- try {
- fakeXhr[attr] = xhr[attr]
- } catch (e) {
- if (!IE6Re.test(navigator.userAgent)) {
- throw e;
- }
- }
- });
- };
-
- var stateChange = function stateChange() {
- fakeXhr.readyState = xhr.readyState;
- if (xhr.readyState >= FakeXMLHttpRequest.HEADERS_RECEIVED) {
- copyAttrs(["status", "statusText"]);
- }
- if (xhr.readyState >= FakeXMLHttpRequest.LOADING) {
- copyAttrs(["responseText", "response"]);
- }
- if (xhr.readyState === FakeXMLHttpRequest.DONE) {
- copyAttrs(["responseXML"]);
- }
- if (fakeXhr.onreadystatechange) {
- fakeXhr.onreadystatechange.call(fakeXhr, { target: fakeXhr });
- }
- };
-
- if (xhr.addEventListener) {
- for (var event in fakeXhr.eventListeners) {
- if (fakeXhr.eventListeners.hasOwnProperty(event)) {
- each(fakeXhr.eventListeners[event], function (handler) {
- xhr.addEventListener(event, handler);
- });
- }
- }
- xhr.addEventListener("readystatechange", stateChange);
- } else {
- xhr.onreadystatechange = stateChange;
- }
- apply(xhr, "open", xhrArgs);
- };
- FakeXMLHttpRequest.useFilters = false;
-
- function verifyRequestOpened(xhr) {
- if (xhr.readyState != FakeXMLHttpRequest.OPENED) {
- throw new Error("INVALID_STATE_ERR - " + xhr.readyState);
- }
- }
-
- function verifyRequestSent(xhr) {
- if (xhr.readyState == FakeXMLHttpRequest.DONE) {
- throw new Error("Request done");
- }
- }
-
- function verifyHeadersReceived(xhr) {
- if (xhr.async && xhr.readyState != FakeXMLHttpRequest.HEADERS_RECEIVED) {
- throw new Error("No headers received");
- }
- }
-
- function verifyResponseBodyType(body) {
- if (typeof body != "string") {
- var error = new Error("Attempted to respond to fake XMLHttpRequest with " +
- body + ", which is not a string.");
- error.name = "InvalidBodyException";
- throw error;
- }
- }
-
- FakeXMLHttpRequest.parseXML = function parseXML(text) {
- var xmlDoc;
-
- if (typeof DOMParser != "undefined") {
- var parser = new DOMParser();
- xmlDoc = parser.parseFromString(text, "text/xml");
- } else {
- xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
- xmlDoc.async = "false";
- xmlDoc.loadXML(text);
- }
-
- return xmlDoc;
- };
-
- FakeXMLHttpRequest.statusCodes = {
- 100: "Continue",
- 101: "Switching Protocols",
- 200: "OK",
- 201: "Created",
- 202: "Accepted",
- 203: "Non-Authoritative Information",
- 204: "No Content",
- 205: "Reset Content",
- 206: "Partial Content",
- 207: "Multi-Status",
- 300: "Multiple Choice",
- 301: "Moved Permanently",
- 302: "Found",
- 303: "See Other",
- 304: "Not Modified",
- 305: "Use Proxy",
- 307: "Temporary Redirect",
- 400: "Bad Request",
- 401: "Unauthorized",
- 402: "Payment Required",
- 403: "Forbidden",
- 404: "Not Found",
- 405: "Method Not Allowed",
- 406: "Not Acceptable",
- 407: "Proxy Authentication Required",
- 408: "Request Timeout",
- 409: "Conflict",
- 410: "Gone",
- 411: "Length Required",
- 412: "Precondition Failed",
- 413: "Request Entity Too Large",
- 414: "Request-URI Too Long",
- 415: "Unsupported Media Type",
- 416: "Requested Range Not Satisfiable",
- 417: "Expectation Failed",
- 422: "Unprocessable Entity",
- 500: "Internal Server Error",
- 501: "Not Implemented",
- 502: "Bad Gateway",
- 503: "Service Unavailable",
- 504: "Gateway Timeout",
- 505: "HTTP Version Not Supported"
- };
-
- function makeApi(sinon) {
- sinon.xhr = sinonXhr;
-
- sinon.extend(FakeXMLHttpRequest.prototype, sinon.EventTarget, {
- async: true,
-
- open: function open(method, url, async, username, password) {
- this.method = method;
- this.url = url;
- this.async = typeof async == "boolean" ? async : true;
- this.username = username;
- this.password = password;
- this.responseText = null;
- this.responseXML = null;
- this.requestHeaders = {};
- this.sendFlag = false;
-
- if (FakeXMLHttpRequest.useFilters === true) {
- var xhrArgs = arguments;
- var defake = some(FakeXMLHttpRequest.filters, function (filter) {
- return filter.apply(this, xhrArgs)
- });
- if (defake) {
- return FakeXMLHttpRequest.defake(this, arguments);
- }
- }
- this.readyStateChange(FakeXMLHttpRequest.OPENED);
- },
-
- readyStateChange: function readyStateChange(state) {
- this.readyState = state;
-
- if (typeof this.onreadystatechange == "function") {
- try {
- this.onreadystatechange();
- } catch (e) {
- sinon.logError("Fake XHR onreadystatechange handler", e);
- }
- }
-
- switch (this.readyState) {
- case FakeXMLHttpRequest.DONE:
- if (supportsProgress) {
- this.upload.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100}));
- this.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100}));
- }
- this.upload.dispatchEvent(new sinon.Event("load", false, false, this));
- this.dispatchEvent(new sinon.Event("load", false, false, this));
- this.dispatchEvent(new sinon.Event("loadend", false, false, this));
- break;
- }
-
- this.dispatchEvent(new sinon.Event("readystatechange"));
- },
-
- setRequestHeader: function setRequestHeader(header, value) {
- verifyState(this);
-
- if (unsafeHeaders[header] || /^(Sec-|Proxy-)/.test(header)) {
- throw new Error("Refused to set unsafe header \"" + header + "\"");
- }
-
- if (this.requestHeaders[header]) {
- this.requestHeaders[header] += "," + value;
- } else {
- this.requestHeaders[header] = value;
- }
- },
-
- // Helps testing
- setResponseHeaders: function setResponseHeaders(headers) {
- verifyRequestOpened(this);
- this.responseHeaders = {};
-
- for (var header in headers) {
- if (headers.hasOwnProperty(header)) {
- this.responseHeaders[header] = headers[header];
- }
- }
-
- if (this.async) {
- this.readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED);
- } else {
- this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED;
- }
- },
-
- // Currently treats ALL data as a DOMString (i.e. no Document)
- send: function send(data) {
- verifyState(this);
-
- if (!/^(get|head)$/i.test(this.method)) {
- var contentType = getHeader(this.requestHeaders, "Content-Type");
- if (this.requestHeaders[contentType]) {
- var value = this.requestHeaders[contentType].split(";");
- this.requestHeaders[contentType] = value[0] + ";charset=utf-8";
- } else if (supportsFormData && !(data instanceof FormData)) {
- this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8";
- }
-
- this.requestBody = data;
- }
-
- this.errorFlag = false;
- this.sendFlag = this.async;
- this.readyStateChange(FakeXMLHttpRequest.OPENED);
-
- if (typeof this.onSend == "function") {
- this.onSend(this);
- }
-
- this.dispatchEvent(new sinon.Event("loadstart", false, false, this));
- },
-
- abort: function abort() {
- this.aborted = true;
- this.responseText = null;
- this.errorFlag = true;
- this.requestHeaders = {};
- this.responseHeaders = {};
-
- if (this.readyState > FakeXMLHttpRequest.UNSENT && this.sendFlag) {
- this.readyStateChange(FakeXMLHttpRequest.DONE);
- this.sendFlag = false;
- }
-
- this.readyState = FakeXMLHttpRequest.UNSENT;
-
- this.dispatchEvent(new sinon.Event("abort", false, false, this));
-
- this.upload.dispatchEvent(new sinon.Event("abort", false, false, this));
-
- if (typeof this.onerror === "function") {
- this.onerror();
- }
- },
-
- getResponseHeader: function getResponseHeader(header) {
- if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) {
- return null;
- }
-
- if (/^Set-Cookie2?$/i.test(header)) {
- return null;
- }
-
- header = getHeader(this.responseHeaders, header);
-
- return this.responseHeaders[header] || null;
- },
-
- getAllResponseHeaders: function getAllResponseHeaders() {
- if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) {
- return "";
- }
-
- var headers = "";
-
- for (var header in this.responseHeaders) {
- if (this.responseHeaders.hasOwnProperty(header) &&
- !/^Set-Cookie2?$/i.test(header)) {
- headers += header + ": " + this.responseHeaders[header] + "\r\n";
- }
- }
-
- return headers;
- },
-
- setResponseBody: function setResponseBody(body) {
- verifyRequestSent(this);
- verifyHeadersReceived(this);
- verifyResponseBodyType(body);
-
- var chunkSize = this.chunkSize || 10;
- var index = 0;
- this.responseText = "";
-
- do {
- if (this.async) {
- this.readyStateChange(FakeXMLHttpRequest.LOADING);
- }
-
- this.responseText += body.substring(index, index + chunkSize);
- index += chunkSize;
- } while (index < body.length);
-
- var type = this.getResponseHeader("Content-Type");
-
- if (this.responseText &&
- (!type || /(text\/xml)|(application\/xml)|(\+xml)/.test(type))) {
- try {
- this.responseXML = FakeXMLHttpRequest.parseXML(this.responseText);
- } catch (e) {
- // Unable to parse XML - no biggie
- }
- }
-
- this.readyStateChange(FakeXMLHttpRequest.DONE);
- },
-
- respond: function respond(status, headers, body) {
- this.status = typeof status == "number" ? status : 200;
- this.statusText = FakeXMLHttpRequest.statusCodes[this.status];
- this.setResponseHeaders(headers || {});
- this.setResponseBody(body || "");
- },
-
- uploadProgress: function uploadProgress(progressEventRaw) {
- if (supportsProgress) {
- this.upload.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw));
- }
- },
-
- downloadProgress: function downloadProgress(progressEventRaw) {
- if (supportsProgress) {
- this.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw));
- }
- },
-
- uploadError: function uploadError(error) {
- if (supportsCustomEvent) {
- this.upload.dispatchEvent(new sinon.CustomEvent("error", {detail: error}));
- }
- }
- });
-
- sinon.extend(FakeXMLHttpRequest, {
- UNSENT: 0,
- OPENED: 1,
- HEADERS_RECEIVED: 2,
- LOADING: 3,
- DONE: 4
- });
-
- sinon.useFakeXMLHttpRequest = function () {
- FakeXMLHttpRequest.restore = function restore(keepOnCreate) {
- if (sinonXhr.supportsXHR) {
- global.XMLHttpRequest = sinonXhr.GlobalXMLHttpRequest;
- }
-
- if (sinonXhr.supportsActiveX) {
- global.ActiveXObject = sinonXhr.GlobalActiveXObject;
- }
-
- delete FakeXMLHttpRequest.restore;
-
- if (keepOnCreate !== true) {
- delete FakeXMLHttpRequest.onCreate;
- }
- };
- if (sinonXhr.supportsXHR) {
- global.XMLHttpRequest = FakeXMLHttpRequest;
- }
-
- if (sinonXhr.supportsActiveX) {
- global.ActiveXObject = function ActiveXObject(objId) {
- if (objId == "Microsoft.XMLHTTP" || /^Msxml2\.XMLHTTP/i.test(objId)) {
-
- return new FakeXMLHttpRequest();
- }
-
- return new sinonXhr.GlobalActiveXObject(objId);
- };
- }
-
- return FakeXMLHttpRequest;
- };
-
- sinon.FakeXMLHttpRequest = FakeXMLHttpRequest;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./core");
- require("../extend");
- require("./event");
- require("../log_error");
- makeApi(sinon);
- module.exports = sinon;
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (typeof sinon === "undefined") {
- return;
- } else {
- makeApi(sinon);
- }
-
-})(typeof global !== "undefined" ? global : self);
-
-/**
- * @depend fake_xdomain_request.js
- * @depend fake_xml_http_request.js
- * @depend ../format.js
- * @depend ../log_error.js
- */
-/**
- * The Sinon "server" mimics a web server that receives requests from
- * sinon.FakeXMLHttpRequest and provides an API to respond to those requests,
- * both synchronously and asynchronously. To respond synchronuously, canned
- * answers have to be provided upfront.
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-if (typeof sinon == "undefined") {
- var sinon = {};
-}
-
-(function () {
- var push = [].push;
- function F() {}
-
- function create(proto) {
- F.prototype = proto;
- return new F();
- }
-
- function responseArray(handler) {
- var response = handler;
-
- if (Object.prototype.toString.call(handler) != "[object Array]") {
- response = [200, {}, handler];
- }
-
- if (typeof response[2] != "string") {
- throw new TypeError("Fake server response body should be string, but was " +
- typeof response[2]);
- }
-
- return response;
- }
-
- var wloc = typeof window !== "undefined" ? window.location : {};
- var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host);
-
- function matchOne(response, reqMethod, reqUrl) {
- var rmeth = response.method;
- var matchMethod = !rmeth || rmeth.toLowerCase() == reqMethod.toLowerCase();
- var url = response.url;
- var matchUrl = !url || url == reqUrl || (typeof url.test == "function" && url.test(reqUrl));
-
- return matchMethod && matchUrl;
- }
-
- function match(response, request) {
- var requestUrl = request.url;
-
- if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) {
- requestUrl = requestUrl.replace(rCurrLoc, "");
- }
-
- if (matchOne(response, this.getHTTPMethod(request), requestUrl)) {
- if (typeof response.response == "function") {
- var ru = response.url;
- var args = [request].concat(ru && typeof ru.exec == "function" ? ru.exec(requestUrl).slice(1) : []);
- return response.response.apply(response, args);
- }
-
- return true;
- }
-
- return false;
- }
-
- function makeApi(sinon) {
- sinon.fakeServer = {
- create: function () {
- var server = create(this);
- if (!sinon.xhr.supportsCORS) {
- this.xhr = sinon.useFakeXDomainRequest();
- } else {
- this.xhr = sinon.useFakeXMLHttpRequest();
- }
- server.requests = [];
-
- this.xhr.onCreate = function (xhrObj) {
- server.addRequest(xhrObj);
- };
-
- return server;
- },
-
- addRequest: function addRequest(xhrObj) {
- var server = this;
- push.call(this.requests, xhrObj);
-
- xhrObj.onSend = function () {
- server.handleRequest(this);
-
- if (server.respondImmediately) {
- server.respond();
- } else if (server.autoRespond && !server.responding) {
- setTimeout(function () {
- server.responding = false;
- server.respond();
- }, server.autoRespondAfter || 10);
-
- server.responding = true;
- }
- };
- },
-
- getHTTPMethod: function getHTTPMethod(request) {
- if (this.fakeHTTPMethods && /post/i.test(request.method)) {
- var matches = (request.requestBody || "").match(/_method=([^\b;]+)/);
- return !!matches ? matches[1] : request.method;
- }
-
- return request.method;
- },
-
- handleRequest: function handleRequest(xhr) {
- if (xhr.async) {
- if (!this.queue) {
- this.queue = [];
- }
-
- push.call(this.queue, xhr);
- } else {
- this.processRequest(xhr);
- }
- },
-
- log: function log(response, request) {
- var str;
-
- str = "Request:\n" + sinon.format(request) + "\n\n";
- str += "Response:\n" + sinon.format(response) + "\n\n";
-
- sinon.log(str);
- },
-
- respondWith: function respondWith(method, url, body) {
- if (arguments.length == 1 && typeof method != "function") {
- this.response = responseArray(method);
- return;
- }
-
- if (!this.responses) {
- this.responses = [];
- }
-
- if (arguments.length == 1) {
- body = method;
- url = method = null;
- }
-
- if (arguments.length == 2) {
- body = url;
- url = method;
- method = null;
- }
-
- push.call(this.responses, {
- method: method,
- url: url,
- response: typeof body == "function" ? body : responseArray(body)
- });
- },
-
- respond: function respond() {
- if (arguments.length > 0) {
- this.respondWith.apply(this, arguments);
- }
-
- var queue = this.queue || [];
- var requests = queue.splice(0, queue.length);
- var request;
-
- while (request = requests.shift()) {
- this.processRequest(request);
- }
- },
-
- processRequest: function processRequest(request) {
- try {
- if (request.aborted) {
- return;
- }
-
- var response = this.response || [404, {}, ""];
-
- if (this.responses) {
- for (var l = this.responses.length, i = l - 1; i >= 0; i--) {
- if (match.call(this, this.responses[i], request)) {
- response = this.responses[i].response;
- break;
- }
- }
- }
-
- if (request.readyState != 4) {
- this.log(response, request);
-
- request.respond(response[0], response[1], response[2]);
- }
- } catch (e) {
- sinon.logError("Fake server request processing", e);
- }
- },
-
- restore: function restore() {
- return this.xhr.restore && this.xhr.restore.apply(this.xhr, arguments);
- }
- };
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./core");
- require("./fake_xdomain_request");
- require("./fake_xml_http_request");
- require("../format");
- makeApi(sinon);
- module.exports = sinon;
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else {
- makeApi(sinon);
- }
-}());
-
-/**
- * @depend fake_server.js
- * @depend fake_timers.js
- */
-/**
- * Add-on for sinon.fakeServer that automatically handles a fake timer along with
- * the FakeXMLHttpRequest. The direct inspiration for this add-on is jQuery
- * 1.3.x, which does not use xhr object's onreadystatehandler at all - instead,
- * it polls the object for completion with setInterval. Dispite the direct
- * motivation, there is nothing jQuery-specific in this file, so it can be used
- * in any environment where the ajax implementation depends on setInterval or
- * setTimeout.
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function () {
- function makeApi(sinon) {
- function Server() {}
- Server.prototype = sinon.fakeServer;
-
- sinon.fakeServerWithClock = new Server();
-
- sinon.fakeServerWithClock.addRequest = function addRequest(xhr) {
- if (xhr.async) {
- if (typeof setTimeout.clock == "object") {
- this.clock = setTimeout.clock;
- } else {
- this.clock = sinon.useFakeTimers();
- this.resetClock = true;
- }
-
- if (!this.longestTimeout) {
- var clockSetTimeout = this.clock.setTimeout;
- var clockSetInterval = this.clock.setInterval;
- var server = this;
-
- this.clock.setTimeout = function (fn, timeout) {
- server.longestTimeout = Math.max(timeout, server.longestTimeout || 0);
-
- return clockSetTimeout.apply(this, arguments);
- };
-
- this.clock.setInterval = function (fn, timeout) {
- server.longestTimeout = Math.max(timeout, server.longestTimeout || 0);
-
- return clockSetInterval.apply(this, arguments);
- };
- }
- }
-
- return sinon.fakeServer.addRequest.call(this, xhr);
- };
-
- sinon.fakeServerWithClock.respond = function respond() {
- var returnVal = sinon.fakeServer.respond.apply(this, arguments);
-
- if (this.clock) {
- this.clock.tick(this.longestTimeout || 0);
- this.longestTimeout = 0;
-
- if (this.resetClock) {
- this.clock.restore();
- this.resetClock = false;
- }
- }
-
- return returnVal;
- };
-
- sinon.fakeServerWithClock.restore = function restore() {
- if (this.clock) {
- this.clock.restore();
- }
-
- return sinon.fakeServer.restore.apply(this, arguments);
- };
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require) {
- var sinon = require("./core");
- require("./fake_server");
- require("./fake_timers");
- makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require);
- } else {
- makeApi(sinon);
- }
-}());
-
-/**
- * @depend util/core.js
- * @depend extend.js
- * @depend collection.js
- * @depend util/fake_timers.js
- * @depend util/fake_server_with_clock.js
- */
-/**
- * Manages fake collections as well as fake utilities such as Sinon's
- * timers and fake XHR implementation in one convenient object.
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function () {
- function makeApi(sinon) {
- var push = [].push;
-
- function exposeValue(sandbox, config, key, value) {
- if (!value) {
- return;
- }
-
- if (config.injectInto && !(key in config.injectInto)) {
- config.injectInto[key] = value;
- sandbox.injectedKeys.push(key);
- } else {
- push.call(sandbox.args, value);
- }
- }
-
- function prepareSandboxFromConfig(config) {
- var sandbox = sinon.create(sinon.sandbox);
-
- if (config.useFakeServer) {
- if (typeof config.useFakeServer == "object") {
- sandbox.serverPrototype = config.useFakeServer;
- }
-
- sandbox.useFakeServer();
- }
-
- if (config.useFakeTimers) {
- if (typeof config.useFakeTimers == "object") {
- sandbox.useFakeTimers.apply(sandbox, config.useFakeTimers);
- } else {
- sandbox.useFakeTimers();
- }
- }
-
- return sandbox;
- }
-
- sinon.sandbox = sinon.extend(sinon.create(sinon.collection), {
- useFakeTimers: function useFakeTimers() {
- this.clock = sinon.useFakeTimers.apply(sinon, arguments);
-
- return this.add(this.clock);
- },
-
- serverPrototype: sinon.fakeServer,
-
- useFakeServer: function useFakeServer() {
- var proto = this.serverPrototype || sinon.fakeServer;
-
- if (!proto || !proto.create) {
- return null;
- }
-
- this.server = proto.create();
- return this.add(this.server);
- },
-
- inject: function (obj) {
- sinon.collection.inject.call(this, obj);
-
- if (this.clock) {
- obj.clock = this.clock;
- }
-
- if (this.server) {
- obj.server = this.server;
- obj.requests = this.server.requests;
- }
-
- obj.match = sinon.match;
-
- return obj;
- },
-
- restore: function () {
- sinon.collection.restore.apply(this, arguments);
- this.restoreContext();
- },
-
- restoreContext: function () {
- if (this.injectedKeys) {
- for (var i = 0, j = this.injectedKeys.length; i < j; i++) {
- delete this.injectInto[this.injectedKeys[i]];
- }
- this.injectedKeys = [];
- }
- },
-
- create: function (config) {
- if (!config) {
- return sinon.create(sinon.sandbox);
- }
-
- var sandbox = prepareSandboxFromConfig(config);
- sandbox.args = sandbox.args || [];
- sandbox.injectedKeys = [];
- sandbox.injectInto = config.injectInto;
- var prop, value, exposed = sandbox.inject({});
-
- if (config.properties) {
- for (var i = 0, l = config.properties.length; i < l; i++) {
- prop = config.properties[i];
- value = exposed[prop] || prop == "sandbox" && sandbox;
- exposeValue(sandbox, config, prop, value);
- }
- } else {
- exposeValue(sandbox, config, "sandbox", value);
- }
-
- return sandbox;
- },
-
- match: sinon.match
- });
-
- sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer;
-
- return sinon.sandbox;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- require("./extend");
- require("./util/fake_server_with_clock");
- require("./util/fake_timers");
- require("./collection");
- module.exports = makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}());
-
-/**
- * @depend util/core.js
- * @depend sandbox.js
- */
-/**
- * Test function, sandboxes fakes
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function (sinon) {
- function makeApi(sinon) {
- var slice = Array.prototype.slice;
-
- function test(callback) {
- var type = typeof callback;
-
- if (type != "function") {
- throw new TypeError("sinon.test needs to wrap a test function, got " + type);
- }
-
- function sinonSandboxedTest() {
- var config = sinon.getConfig(sinon.config);
- config.injectInto = config.injectIntoThis && this || config.injectInto;
- var sandbox = sinon.sandbox.create(config);
- var args = slice.call(arguments);
- var oldDone = args.length && args[args.length - 1];
- var exception, result;
-
- if (typeof oldDone == "function") {
- args[args.length - 1] = function sinonDone(result) {
- if (result) {
- sandbox.restore();
- throw exception;
- } else {
- sandbox.verifyAndRestore();
- }
- oldDone(result);
- };
- }
-
- try {
- result = callback.apply(this, args.concat(sandbox.args));
- } catch (e) {
- exception = e;
- }
-
- if (typeof oldDone != "function") {
- if (typeof exception !== "undefined") {
- sandbox.restore();
- throw exception;
- } else {
- sandbox.verifyAndRestore();
- }
- }
-
- return result;
- }
-
- if (callback.length) {
- return function sinonAsyncSandboxedTest(callback) {
- return sinonSandboxedTest.apply(this, arguments);
- };
- }
-
- return sinonSandboxedTest;
- }
-
- test.config = {
- injectIntoThis: true,
- injectInto: null,
- properties: ["spy", "stub", "mock", "clock", "server", "requests"],
- useFakeTimers: true,
- useFakeServer: true
- };
-
- sinon.test = test;
- return test;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- require("./sandbox");
- module.exports = makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (sinon) {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend util/core.js
- * @depend test.js
- */
-/**
- * Test case, sandboxes all test functions
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function (sinon) {
- function createTest(property, setUp, tearDown) {
- return function () {
- if (setUp) {
- setUp.apply(this, arguments);
- }
-
- var exception, result;
-
- try {
- result = property.apply(this, arguments);
- } catch (e) {
- exception = e;
- }
-
- if (tearDown) {
- tearDown.apply(this, arguments);
- }
-
- if (exception) {
- throw exception;
- }
-
- return result;
- };
- }
-
- function makeApi(sinon) {
- function testCase(tests, prefix) {
- if (!tests || typeof tests != "object") {
- throw new TypeError("sinon.testCase needs an object with test functions");
- }
-
- prefix = prefix || "test";
- var rPrefix = new RegExp("^" + prefix);
- var methods = {}, testName, property, method;
- var setUp = tests.setUp;
- var tearDown = tests.tearDown;
-
- for (testName in tests) {
- if (tests.hasOwnProperty(testName) && !/^(setUp|tearDown)$/.test(testName)) {
- property = tests[testName];
-
- if (typeof property == "function" && rPrefix.test(testName)) {
- method = property;
-
- if (setUp || tearDown) {
- method = createTest(property, setUp, tearDown);
- }
-
- methods[testName] = sinon.test(method);
- } else {
- methods[testName] = tests[testName];
- }
- }
- }
-
- return methods;
- }
-
- sinon.testCase = testCase;
- return testCase;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- require("./test");
- module.exports = makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-}(typeof sinon == "object" && sinon || null));
-
-/**
- * @depend times_in_words.js
- * @depend util/core.js
- * @depend match.js
- * @depend format.js
- */
-/**
- * Assertions matching the test spy retrieval interface.
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-
-(function (sinon, global) {
- var slice = Array.prototype.slice;
-
- function makeApi(sinon) {
- var assert;
-
- function verifyIsStub() {
- var method;
-
- for (var i = 0, l = arguments.length; i < l; ++i) {
- method = arguments[i];
-
- if (!method) {
- assert.fail("fake is not a spy");
- }
-
- if (method.proxy && method.proxy.isSinonProxy) {
- verifyIsStub(method.proxy);
- } else {
- if (typeof method != "function") {
- assert.fail(method + " is not a function");
- }
-
- if (typeof method.getCall != "function") {
- assert.fail(method + " is not stubbed");
- }
- }
-
- }
- }
-
- function failAssertion(object, msg) {
- object = object || global;
- var failMethod = object.fail || assert.fail;
- failMethod.call(object, msg);
- }
-
- function mirrorPropAsAssertion(name, method, message) {
- if (arguments.length == 2) {
- message = method;
- method = name;
- }
-
- assert[name] = function (fake) {
- verifyIsStub(fake);
-
- var args = slice.call(arguments, 1);
- var failed = false;
-
- if (typeof method == "function") {
- failed = !method(fake);
- } else {
- failed = typeof fake[method] == "function" ?
- !fake[method].apply(fake, args) : !fake[method];
- }
-
- if (failed) {
- failAssertion(this, (fake.printf || fake.proxy.printf).apply(fake, [message].concat(args)));
- } else {
- assert.pass(name);
- }
- };
- }
-
- function exposedName(prefix, prop) {
- return !prefix || /^fail/.test(prop) ? prop :
- prefix + prop.slice(0, 1).toUpperCase() + prop.slice(1);
- }
-
- assert = {
- failException: "AssertError",
-
- fail: function fail(message) {
- var error = new Error(message);
- error.name = this.failException || assert.failException;
-
- throw error;
- },
-
- pass: function pass(assertion) {},
-
- callOrder: function assertCallOrder() {
- verifyIsStub.apply(null, arguments);
- var expected = "", actual = "";
-
- if (!sinon.calledInOrder(arguments)) {
- try {
- expected = [].join.call(arguments, ", ");
- var calls = slice.call(arguments);
- var i = calls.length;
- while (i) {
- if (!calls[--i].called) {
- calls.splice(i, 1);
- }
- }
- actual = sinon.orderByFirstCall(calls).join(", ");
- } catch (e) {
- // If this fails, we'll just fall back to the blank string
- }
-
- failAssertion(this, "expected " + expected + " to be " +
- "called in order but were called as " + actual);
- } else {
- assert.pass("callOrder");
- }
- },
-
- callCount: function assertCallCount(method, count) {
- verifyIsStub(method);
-
- if (method.callCount != count) {
- var msg = "expected %n to be called " + sinon.timesInWords(count) +
- " but was called %c%C";
- failAssertion(this, method.printf(msg));
- } else {
- assert.pass("callCount");
- }
- },
-
- expose: function expose(target, options) {
- if (!target) {
- throw new TypeError("target is null or undefined");
- }
-
- var o = options || {};
- var prefix = typeof o.prefix == "undefined" && "assert" || o.prefix;
- var includeFail = typeof o.includeFail == "undefined" || !!o.includeFail;
-
- for (var method in this) {
- if (method != "expose" && (includeFail || !/^(fail)/.test(method))) {
- target[exposedName(prefix, method)] = this[method];
- }
- }
-
- return target;
- },
-
- match: function match(actual, expectation) {
- var matcher = sinon.match(expectation);
- if (matcher.test(actual)) {
- assert.pass("match");
- } else {
- var formatted = [
- "expected value to match",
- " expected = " + sinon.format(expectation),
- " actual = " + sinon.format(actual)
- ]
- failAssertion(this, formatted.join("\n"));
- }
- }
- };
-
- mirrorPropAsAssertion("called", "expected %n to have been called at least once but was never called");
- mirrorPropAsAssertion("notCalled", function (spy) {
- return !spy.called;
- }, "expected %n to not have been called but was called %c%C");
- mirrorPropAsAssertion("calledOnce", "expected %n to be called once but was called %c%C");
- mirrorPropAsAssertion("calledTwice", "expected %n to be called twice but was called %c%C");
- mirrorPropAsAssertion("calledThrice", "expected %n to be called thrice but was called %c%C");
- mirrorPropAsAssertion("calledOn", "expected %n to be called with %1 as this but was called with %t");
- mirrorPropAsAssertion("alwaysCalledOn", "expected %n to always be called with %1 as this but was called with %t");
- mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new");
- mirrorPropAsAssertion("alwaysCalledWithNew", "expected %n to always be called with new");
- mirrorPropAsAssertion("calledWith", "expected %n to be called with arguments %*%C");
- mirrorPropAsAssertion("calledWithMatch", "expected %n to be called with match %*%C");
- mirrorPropAsAssertion("alwaysCalledWith", "expected %n to always be called with arguments %*%C");
- mirrorPropAsAssertion("alwaysCalledWithMatch", "expected %n to always be called with match %*%C");
- mirrorPropAsAssertion("calledWithExactly", "expected %n to be called with exact arguments %*%C");
- mirrorPropAsAssertion("alwaysCalledWithExactly", "expected %n to always be called with exact arguments %*%C");
- mirrorPropAsAssertion("neverCalledWith", "expected %n to never be called with arguments %*%C");
- mirrorPropAsAssertion("neverCalledWithMatch", "expected %n to never be called with match %*%C");
- mirrorPropAsAssertion("threw", "%n did not throw exception%C");
- mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C");
-
- sinon.assert = assert;
- return assert;
- }
-
- var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
- var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
-
- function loadDependencies(require, exports, module) {
- var sinon = require("./util/core");
- require("./match");
- require("./format");
- module.exports = makeApi(sinon);
- }
-
- if (isAMD) {
- define(loadDependencies);
- } else if (isNode) {
- loadDependencies(require, module.exports, module);
- } else if (!sinon) {
- return;
- } else {
- makeApi(sinon);
- }
-
-}(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global));
-
- return sinon;
-}));
--- /dev/null
+/**
+ * Sinon.JS 1.15.4, 2015/06/27
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
+ *
+ * (The BSD License)
+ *
+ * Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of Christian Johansen nor the names of his contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+(function (root, factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ define('sinon', [], function () {
+ return (root.sinon = factory());
+ });
+ } else if (typeof exports === 'object') {
+ module.exports = factory();
+ } else {
+ root.sinon = factory();
+ }
+}(this, function () {
+ 'use strict';
+ var samsam, formatio, lolex;
+ (function () {
+ function define(mod, deps, fn) {
+ if (mod == "samsam") {
+ samsam = deps();
+ } else if (typeof deps === "function" && mod.length === 0) {
+ lolex = deps();
+ } else if (typeof fn === "function") {
+ formatio = fn(samsam);
+ }
+ }
+ define.amd = {};
+((typeof define === "function" && define.amd && function (m) { define("samsam", m); }) ||
+ (typeof module === "object" &&
+ function (m) { module.exports = m(); }) || // Node
+ function (m) { this.samsam = m(); } // Browser globals
+)(function () {
+ var o = Object.prototype;
+ var div = typeof document !== "undefined" && document.createElement("div");
+
+ function isNaN(value) {
+ // Unlike global isNaN, this avoids type coercion
+ // typeof check avoids IE host object issues, hat tip to
+ // lodash
+ var val = value; // JsLint thinks value !== value is "weird"
+ return typeof value === "number" && value !== val;
+ }
+
+ function getClass(value) {
+ // Returns the internal [[Class]] by calling Object.prototype.toString
+ // with the provided value as this. Return value is a string, naming the
+ // internal class, e.g. "Array"
+ return o.toString.call(value).split(/[ \]]/)[1];
+ }
+
+ /**
+ * @name samsam.isArguments
+ * @param Object object
+ *
+ * Returns ``true`` if ``object`` is an ``arguments`` object,
+ * ``false`` otherwise.
+ */
+ function isArguments(object) {
+ if (getClass(object) === 'Arguments') { return true; }
+ if (typeof object !== "object" || typeof object.length !== "number" ||
+ getClass(object) === "Array") {
+ return false;
+ }
+ if (typeof object.callee == "function") { return true; }
+ try {
+ object[object.length] = 6;
+ delete object[object.length];
+ } catch (e) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @name samsam.isElement
+ * @param Object object
+ *
+ * Returns ``true`` if ``object`` is a DOM element node. Unlike
+ * Underscore.js/lodash, this function will return ``false`` if ``object``
+ * is an *element-like* object, i.e. a regular object with a ``nodeType``
+ * property that holds the value ``1``.
+ */
+ function isElement(object) {
+ if (!object || object.nodeType !== 1 || !div) { return false; }
+ try {
+ object.appendChild(div);
+ object.removeChild(div);
+ } catch (e) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @name samsam.keys
+ * @param Object object
+ *
+ * Return an array of own property names.
+ */
+ function keys(object) {
+ var ks = [], prop;
+ for (prop in object) {
+ if (o.hasOwnProperty.call(object, prop)) { ks.push(prop); }
+ }
+ return ks;
+ }
+
+ /**
+ * @name samsam.isDate
+ * @param Object value
+ *
+ * Returns true if the object is a ``Date``, or *date-like*. Duck typing
+ * of date objects work by checking that the object has a ``getTime``
+ * function whose return value equals the return value from the object's
+ * ``valueOf``.
+ */
+ function isDate(value) {
+ return typeof value.getTime == "function" &&
+ value.getTime() == value.valueOf();
+ }
+
+ /**
+ * @name samsam.isNegZero
+ * @param Object value
+ *
+ * Returns ``true`` if ``value`` is ``-0``.
+ */
+ function isNegZero(value) {
+ return value === 0 && 1 / value === -Infinity;
+ }
+
+ /**
+ * @name samsam.equal
+ * @param Object obj1
+ * @param Object obj2
+ *
+ * Returns ``true`` if two objects are strictly equal. Compared to
+ * ``===`` there are two exceptions:
+ *
+ * - NaN is considered equal to NaN
+ * - -0 and +0 are not considered equal
+ */
+ function identical(obj1, obj2) {
+ if (obj1 === obj2 || (isNaN(obj1) && isNaN(obj2))) {
+ return obj1 !== 0 || isNegZero(obj1) === isNegZero(obj2);
+ }
+ }
+
+
+ /**
+ * @name samsam.deepEqual
+ * @param Object obj1
+ * @param Object obj2
+ *
+ * Deep equal comparison. Two values are "deep equal" if:
+ *
+ * - They are equal, according to samsam.identical
+ * - They are both date objects representing the same time
+ * - They are both arrays containing elements that are all deepEqual
+ * - They are objects with the same set of properties, and each property
+ * in ``obj1`` is deepEqual to the corresponding property in ``obj2``
+ *
+ * Supports cyclic objects.
+ */
+ function deepEqualCyclic(obj1, obj2) {
+
+ // used for cyclic comparison
+ // contain already visited objects
+ var objects1 = [],
+ objects2 = [],
+ // contain pathes (position in the object structure)
+ // of the already visited objects
+ // indexes same as in objects arrays
+ paths1 = [],
+ paths2 = [],
+ // contains combinations of already compared objects
+ // in the manner: { "$1['ref']$2['ref']": true }
+ compared = {};
+
+ /**
+ * used to check, if the value of a property is an object
+ * (cyclic logic is only needed for objects)
+ * only needed for cyclic logic
+ */
+ function isObject(value) {
+
+ if (typeof value === 'object' && value !== null &&
+ !(value instanceof Boolean) &&
+ !(value instanceof Date) &&
+ !(value instanceof Number) &&
+ !(value instanceof RegExp) &&
+ !(value instanceof String)) {
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * returns the index of the given object in the
+ * given objects array, -1 if not contained
+ * only needed for cyclic logic
+ */
+ function getIndex(objects, obj) {
+
+ var i;
+ for (i = 0; i < objects.length; i++) {
+ if (objects[i] === obj) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ // does the recursion for the deep equal check
+ return (function deepEqual(obj1, obj2, path1, path2) {
+ var type1 = typeof obj1;
+ var type2 = typeof obj2;
+
+ // == null also matches undefined
+ if (obj1 === obj2 ||
+ isNaN(obj1) || isNaN(obj2) ||
+ obj1 == null || obj2 == null ||
+ type1 !== "object" || type2 !== "object") {
+
+ return identical(obj1, obj2);
+ }
+
+ // Elements are only equal if identical(expected, actual)
+ if (isElement(obj1) || isElement(obj2)) { return false; }
+
+ var isDate1 = isDate(obj1), isDate2 = isDate(obj2);
+ if (isDate1 || isDate2) {
+ if (!isDate1 || !isDate2 || obj1.getTime() !== obj2.getTime()) {
+ return false;
+ }
+ }
+
+ if (obj1 instanceof RegExp && obj2 instanceof RegExp) {
+ if (obj1.toString() !== obj2.toString()) { return false; }
+ }
+
+ var class1 = getClass(obj1);
+ var class2 = getClass(obj2);
+ var keys1 = keys(obj1);
+ var keys2 = keys(obj2);
+
+ if (isArguments(obj1) || isArguments(obj2)) {
+ if (obj1.length !== obj2.length) { return false; }
+ } else {
+ if (type1 !== type2 || class1 !== class2 ||
+ keys1.length !== keys2.length) {
+ return false;
+ }
+ }
+
+ var key, i, l,
+ // following vars are used for the cyclic logic
+ value1, value2,
+ isObject1, isObject2,
+ index1, index2,
+ newPath1, newPath2;
+
+ for (i = 0, l = keys1.length; i < l; i++) {
+ key = keys1[i];
+ if (!o.hasOwnProperty.call(obj2, key)) {
+ return false;
+ }
+
+ // Start of the cyclic logic
+
+ value1 = obj1[key];
+ value2 = obj2[key];
+
+ isObject1 = isObject(value1);
+ isObject2 = isObject(value2);
+
+ // determine, if the objects were already visited
+ // (it's faster to check for isObject first, than to
+ // get -1 from getIndex for non objects)
+ index1 = isObject1 ? getIndex(objects1, value1) : -1;
+ index2 = isObject2 ? getIndex(objects2, value2) : -1;
+
+ // determine the new pathes of the objects
+ // - for non cyclic objects the current path will be extended
+ // by current property name
+ // - for cyclic objects the stored path is taken
+ newPath1 = index1 !== -1
+ ? paths1[index1]
+ : path1 + '[' + JSON.stringify(key) + ']';
+ newPath2 = index2 !== -1
+ ? paths2[index2]
+ : path2 + '[' + JSON.stringify(key) + ']';
+
+ // stop recursion if current objects are already compared
+ if (compared[newPath1 + newPath2]) {
+ return true;
+ }
+
+ // remember the current objects and their pathes
+ if (index1 === -1 && isObject1) {
+ objects1.push(value1);
+ paths1.push(newPath1);
+ }
+ if (index2 === -1 && isObject2) {
+ objects2.push(value2);
+ paths2.push(newPath2);
+ }
+
+ // remember that the current objects are already compared
+ if (isObject1 && isObject2) {
+ compared[newPath1 + newPath2] = true;
+ }
+
+ // End of cyclic logic
+
+ // neither value1 nor value2 is a cycle
+ // continue with next level
+ if (!deepEqual(value1, value2, newPath1, newPath2)) {
+ return false;
+ }
+ }
+
+ return true;
+
+ }(obj1, obj2, '$1', '$2'));
+ }
+
+ var match;
+
+ function arrayContains(array, subset) {
+ if (subset.length === 0) { return true; }
+ var i, l, j, k;
+ for (i = 0, l = array.length; i < l; ++i) {
+ if (match(array[i], subset[0])) {
+ for (j = 0, k = subset.length; j < k; ++j) {
+ if (!match(array[i + j], subset[j])) { return false; }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @name samsam.match
+ * @param Object object
+ * @param Object matcher
+ *
+ * Compare arbitrary value ``object`` with matcher.
+ */
+ match = function match(object, matcher) {
+ if (matcher && typeof matcher.test === "function") {
+ return matcher.test(object);
+ }
+
+ if (typeof matcher === "function") {
+ return matcher(object) === true;
+ }
+
+ if (typeof matcher === "string") {
+ matcher = matcher.toLowerCase();
+ var notNull = typeof object === "string" || !!object;
+ return notNull &&
+ (String(object)).toLowerCase().indexOf(matcher) >= 0;
+ }
+
+ if (typeof matcher === "number") {
+ return matcher === object;
+ }
+
+ if (typeof matcher === "boolean") {
+ return matcher === object;
+ }
+
+ if (typeof(matcher) === "undefined") {
+ return typeof(object) === "undefined";
+ }
+
+ if (matcher === null) {
+ return object === null;
+ }
+
+ if (getClass(object) === "Array" && getClass(matcher) === "Array") {
+ return arrayContains(object, matcher);
+ }
+
+ if (matcher && typeof matcher === "object") {
+ if (matcher === object) {
+ return true;
+ }
+ var prop;
+ for (prop in matcher) {
+ var value = object[prop];
+ if (typeof value === "undefined" &&
+ typeof object.getAttribute === "function") {
+ value = object.getAttribute(prop);
+ }
+ if (matcher[prop] === null || typeof matcher[prop] === 'undefined') {
+ if (value !== matcher[prop]) {
+ return false;
+ }
+ } else if (typeof value === "undefined" || !match(value, matcher[prop])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ throw new Error("Matcher was not a string, a number, a " +
+ "function, a boolean or an object");
+ };
+
+ return {
+ isArguments: isArguments,
+ isElement: isElement,
+ isDate: isDate,
+ isNegZero: isNegZero,
+ identical: identical,
+ deepEqual: deepEqualCyclic,
+ match: match,
+ keys: keys
+ };
+});
+((typeof define === "function" && define.amd && function (m) {
+ define("formatio", ["samsam"], m);
+}) || (typeof module === "object" && function (m) {
+ module.exports = m(require("samsam"));
+}) || function (m) { this.formatio = m(this.samsam); }
+)(function (samsam) {
+
+ var formatio = {
+ excludeConstructors: ["Object", /^.$/],
+ quoteStrings: true,
+ limitChildrenCount: 0
+ };
+
+ var hasOwn = Object.prototype.hasOwnProperty;
+
+ var specialObjects = [];
+ if (typeof global !== "undefined") {
+ specialObjects.push({ object: global, value: "[object global]" });
+ }
+ if (typeof document !== "undefined") {
+ specialObjects.push({
+ object: document,
+ value: "[object HTMLDocument]"
+ });
+ }
+ if (typeof window !== "undefined") {
+ specialObjects.push({ object: window, value: "[object Window]" });
+ }
+
+ function functionName(func) {
+ if (!func) { return ""; }
+ if (func.displayName) { return func.displayName; }
+ if (func.name) { return func.name; }
+ var matches = func.toString().match(/function\s+([^\(]+)/m);
+ return (matches && matches[1]) || "";
+ }
+
+ function constructorName(f, object) {
+ var name = functionName(object && object.constructor);
+ var excludes = f.excludeConstructors ||
+ formatio.excludeConstructors || [];
+
+ var i, l;
+ for (i = 0, l = excludes.length; i < l; ++i) {
+ if (typeof excludes[i] === "string" && excludes[i] === name) {
+ return "";
+ } else if (excludes[i].test && excludes[i].test(name)) {
+ return "";
+ }
+ }
+
+ return name;
+ }
+
+ function isCircular(object, objects) {
+ if (typeof object !== "object") { return false; }
+ var i, l;
+ for (i = 0, l = objects.length; i < l; ++i) {
+ if (objects[i] === object) { return true; }
+ }
+ return false;
+ }
+
+ function ascii(f, object, processed, indent) {
+ if (typeof object === "string") {
+ var qs = f.quoteStrings;
+ var quote = typeof qs !== "boolean" || qs;
+ return processed || quote ? '"' + object + '"' : object;
+ }
+
+ if (typeof object === "function" && !(object instanceof RegExp)) {
+ return ascii.func(object);
+ }
+
+ processed = processed || [];
+
+ if (isCircular(object, processed)) { return "[Circular]"; }
+
+ if (Object.prototype.toString.call(object) === "[object Array]") {
+ return ascii.array.call(f, object, processed);
+ }
+
+ if (!object) { return String((1/object) === -Infinity ? "-0" : object); }
+ if (samsam.isElement(object)) { return ascii.element(object); }
+
+ if (typeof object.toString === "function" &&
+ object.toString !== Object.prototype.toString) {
+ return object.toString();
+ }
+
+ var i, l;
+ for (i = 0, l = specialObjects.length; i < l; i++) {
+ if (object === specialObjects[i].object) {
+ return specialObjects[i].value;
+ }
+ }
+
+ return ascii.object.call(f, object, processed, indent);
+ }
+
+ ascii.func = function (func) {
+ return "function " + functionName(func) + "() {}";
+ };
+
+ ascii.array = function (array, processed) {
+ processed = processed || [];
+ processed.push(array);
+ var pieces = [];
+ var i, l;
+ l = (this.limitChildrenCount > 0) ?
+ Math.min(this.limitChildrenCount, array.length) : array.length;
+
+ for (i = 0; i < l; ++i) {
+ pieces.push(ascii(this, array[i], processed));
+ }
+
+ if(l < array.length)
+ pieces.push("[... " + (array.length - l) + " more elements]");
+
+ return "[" + pieces.join(", ") + "]";
+ };
+
+ ascii.object = function (object, processed, indent) {
+ processed = processed || [];
+ processed.push(object);
+ indent = indent || 0;
+ var pieces = [], properties = samsam.keys(object).sort();
+ var length = 3;
+ var prop, str, obj, i, k, l;
+ l = (this.limitChildrenCount > 0) ?
+ Math.min(this.limitChildrenCount, properties.length) : properties.length;
+
+ for (i = 0; i < l; ++i) {
+ prop = properties[i];
+ obj = object[prop];
+
+ if (isCircular(obj, processed)) {
+ str = "[Circular]";
+ } else {
+ str = ascii(this, obj, processed, indent + 2);
+ }
+
+ str = (/\s/.test(prop) ? '"' + prop + '"' : prop) + ": " + str;
+ length += str.length;
+ pieces.push(str);
+ }
+
+ var cons = constructorName(this, object);
+ var prefix = cons ? "[" + cons + "] " : "";
+ var is = "";
+ for (i = 0, k = indent; i < k; ++i) { is += " "; }
+
+ if(l < properties.length)
+ pieces.push("[... " + (properties.length - l) + " more elements]");
+
+ if (length + indent > 80) {
+ return prefix + "{\n " + is + pieces.join(",\n " + is) + "\n" +
+ is + "}";
+ }
+ return prefix + "{ " + pieces.join(", ") + " }";
+ };
+
+ ascii.element = function (element) {
+ var tagName = element.tagName.toLowerCase();
+ var attrs = element.attributes, attr, pairs = [], attrName, i, l, val;
+
+ for (i = 0, l = attrs.length; i < l; ++i) {
+ attr = attrs.item(i);
+ attrName = attr.nodeName.toLowerCase().replace("html:", "");
+ val = attr.nodeValue;
+ if (attrName !== "contenteditable" || val !== "inherit") {
+ if (!!val) { pairs.push(attrName + "=\"" + val + "\""); }
+ }
+ }
+
+ var formatted = "<" + tagName + (pairs.length > 0 ? " " : "");
+ var content = element.innerHTML;
+
+ if (content.length > 20) {
+ content = content.substr(0, 20) + "[...]";
+ }
+
+ var res = formatted + pairs.join(" ") + ">" + content +
+ "</" + tagName + ">";
+
+ return res.replace(/ contentEditable="inherit"/, "");
+ };
+
+ function Formatio(options) {
+ for (var opt in options) {
+ this[opt] = options[opt];
+ }
+ }
+
+ Formatio.prototype = {
+ functionName: functionName,
+
+ configure: function (options) {
+ return new Formatio(options);
+ },
+
+ constructorName: function (object) {
+ return constructorName(this, object);
+ },
+
+ ascii: function (object, processed, indent) {
+ return ascii(this, object, processed, indent);
+ }
+ };
+
+ return Formatio.prototype;
+});
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.lolex=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+(function (global){
+/*jslint eqeqeq: false, plusplus: false, evil: true, onevar: false, browser: true, forin: false*/
+/*global global*/
+/**
+ * @author Christian Johansen (christian@cjohansen.no) and contributors
+ * @license BSD
+ *
+ * Copyright (c) 2010-2014 Christian Johansen
+ */
+
+// node expects setTimeout/setInterval to return a fn object w/ .ref()/.unref()
+// browsers, a number.
+// see https://github.com/cjohansen/Sinon.JS/pull/436
+var timeoutResult = setTimeout(function() {}, 0);
+var addTimerReturnsObject = typeof timeoutResult === "object";
+clearTimeout(timeoutResult);
+
+var NativeDate = Date;
+var id = 1;
+
+/**
+ * Parse strings like "01:10:00" (meaning 1 hour, 10 minutes, 0 seconds) into
+ * number of milliseconds. This is used to support human-readable strings passed
+ * to clock.tick()
+ */
+function parseTime(str) {
+ if (!str) {
+ return 0;
+ }
+
+ var strings = str.split(":");
+ var l = strings.length, i = l;
+ var ms = 0, parsed;
+
+ if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) {
+ throw new Error("tick only understands numbers and 'h:m:s'");
+ }
+
+ while (i--) {
+ parsed = parseInt(strings[i], 10);
+
+ if (parsed >= 60) {
+ throw new Error("Invalid time " + str);
+ }
+
+ ms += parsed * Math.pow(60, (l - i - 1));
+ }
+
+ return ms * 1000;
+}
+
+/**
+ * Used to grok the `now` parameter to createClock.
+ */
+function getEpoch(epoch) {
+ if (!epoch) { return 0; }
+ if (typeof epoch.getTime === "function") { return epoch.getTime(); }
+ if (typeof epoch === "number") { return epoch; }
+ throw new TypeError("now should be milliseconds since UNIX epoch");
+}
+
+function inRange(from, to, timer) {
+ return timer && timer.callAt >= from && timer.callAt <= to;
+}
+
+function mirrorDateProperties(target, source) {
+ if (source.now) {
+ target.now = function now() {
+ return target.clock.now;
+ };
+ } else {
+ delete target.now;
+ }
+
+ if (source.toSource) {
+ target.toSource = function toSource() {
+ return source.toSource();
+ };
+ } else {
+ delete target.toSource;
+ }
+
+ target.toString = function toString() {
+ return source.toString();
+ };
+
+ target.prototype = source.prototype;
+ target.parse = source.parse;
+ target.UTC = source.UTC;
+ target.prototype.toUTCString = source.prototype.toUTCString;
+
+ for (var prop in source) {
+ if (source.hasOwnProperty(prop)) {
+ target[prop] = source[prop];
+ }
+ }
+
+ return target;
+}
+
+function createDate() {
+ function ClockDate(year, month, date, hour, minute, second, ms) {
+ // Defensive and verbose to avoid potential harm in passing
+ // explicit undefined when user does not pass argument
+ switch (arguments.length) {
+ case 0:
+ return new NativeDate(ClockDate.clock.now);
+ case 1:
+ return new NativeDate(year);
+ case 2:
+ return new NativeDate(year, month);
+ case 3:
+ return new NativeDate(year, month, date);
+ case 4:
+ return new NativeDate(year, month, date, hour);
+ case 5:
+ return new NativeDate(year, month, date, hour, minute);
+ case 6:
+ return new NativeDate(year, month, date, hour, minute, second);
+ default:
+ return new NativeDate(year, month, date, hour, minute, second, ms);
+ }
+ }
+
+ return mirrorDateProperties(ClockDate, NativeDate);
+}
+
+function addTimer(clock, timer) {
+ if (typeof timer.func === "undefined") {
+ throw new Error("Callback must be provided to timer calls");
+ }
+
+ if (!clock.timers) {
+ clock.timers = {};
+ }
+
+ timer.id = id++;
+ timer.createdAt = clock.now;
+ timer.callAt = clock.now + (timer.delay || 0);
+
+ clock.timers[timer.id] = timer;
+
+ if (addTimerReturnsObject) {
+ return {
+ id: timer.id,
+ ref: function() {},
+ unref: function() {}
+ };
+ }
+ else {
+ return timer.id;
+ }
+}
+
+function firstTimerInRange(clock, from, to) {
+ var timers = clock.timers, timer = null;
+
+ for (var id in timers) {
+ if (!inRange(from, to, timers[id])) {
+ continue;
+ }
+
+ if (!timer || ~compareTimers(timer, timers[id])) {
+ timer = timers[id];
+ }
+ }
+
+ return timer;
+}
+
+function compareTimers(a, b) {
+ // Sort first by absolute timing
+ if (a.callAt < b.callAt) {
+ return -1;
+ }
+ if (a.callAt > b.callAt) {
+ return 1;
+ }
+
+ // Sort next by immediate, immediate timers take precedence
+ if (a.immediate && !b.immediate) {
+ return -1;
+ }
+ if (!a.immediate && b.immediate) {
+ return 1;
+ }
+
+ // Sort next by creation time, earlier-created timers take precedence
+ if (a.createdAt < b.createdAt) {
+ return -1;
+ }
+ if (a.createdAt > b.createdAt) {
+ return 1;
+ }
+
+ // Sort next by id, lower-id timers take precedence
+ if (a.id < b.id) {
+ return -1;
+ }
+ if (a.id > b.id) {
+ return 1;
+ }
+
+ // As timer ids are unique, no fallback `0` is necessary
+}
+
+function callTimer(clock, timer) {
+ if (typeof timer.interval == "number") {
+ clock.timers[timer.id].callAt += timer.interval;
+ } else {
+ delete clock.timers[timer.id];
+ }
+
+ try {
+ if (typeof timer.func == "function") {
+ timer.func.apply(null, timer.args);
+ } else {
+ eval(timer.func);
+ }
+ } catch (e) {
+ var exception = e;
+ }
+
+ if (!clock.timers[timer.id]) {
+ if (exception) {
+ throw exception;
+ }
+ return;
+ }
+
+ if (exception) {
+ throw exception;
+ }
+}
+
+function uninstall(clock, target) {
+ var method;
+
+ for (var i = 0, l = clock.methods.length; i < l; i++) {
+ method = clock.methods[i];
+
+ if (target[method].hadOwnProperty) {
+ target[method] = clock["_" + method];
+ } else {
+ try {
+ delete target[method];
+ } catch (e) {}
+ }
+ }
+
+ // Prevent multiple executions which will completely remove these props
+ clock.methods = [];
+}
+
+function hijackMethod(target, method, clock) {
+ clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(target, method);
+ clock["_" + method] = target[method];
+
+ if (method == "Date") {
+ var date = mirrorDateProperties(clock[method], target[method]);
+ target[method] = date;
+ } else {
+ target[method] = function () {
+ return clock[method].apply(clock, arguments);
+ };
+
+ for (var prop in clock[method]) {
+ if (clock[method].hasOwnProperty(prop)) {
+ target[method][prop] = clock[method][prop];
+ }
+ }
+ }
+
+ target[method].clock = clock;
+}
+
+var timers = {
+ setTimeout: setTimeout,
+ clearTimeout: clearTimeout,
+ setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined),
+ clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate: undefined),
+ setInterval: setInterval,
+ clearInterval: clearInterval,
+ Date: Date
+};
+
+var keys = Object.keys || function (obj) {
+ var ks = [];
+ for (var key in obj) {
+ ks.push(key);
+ }
+ return ks;
+};
+
+exports.timers = timers;
+
+var createClock = exports.createClock = function (now) {
+ var clock = {
+ now: getEpoch(now),
+ timeouts: {},
+ Date: createDate()
+ };
+
+ clock.Date.clock = clock;
+
+ clock.setTimeout = function setTimeout(func, timeout) {
+ return addTimer(clock, {
+ func: func,
+ args: Array.prototype.slice.call(arguments, 2),
+ delay: timeout
+ });
+ };
+
+ clock.clearTimeout = function clearTimeout(timerId) {
+ if (!timerId) {
+ // null appears to be allowed in most browsers, and appears to be
+ // relied upon by some libraries, like Bootstrap carousel
+ return;
+ }
+ if (!clock.timers) {
+ clock.timers = [];
+ }
+ // in Node, timerId is an object with .ref()/.unref(), and
+ // its .id field is the actual timer id.
+ if (typeof timerId === "object") {
+ timerId = timerId.id
+ }
+ if (timerId in clock.timers) {
+ delete clock.timers[timerId];
+ }
+ };
+
+ clock.setInterval = function setInterval(func, timeout) {
+ return addTimer(clock, {
+ func: func,
+ args: Array.prototype.slice.call(arguments, 2),
+ delay: timeout,
+ interval: timeout
+ });
+ };
+
+ clock.clearInterval = function clearInterval(timerId) {
+ clock.clearTimeout(timerId);
+ };
+
+ clock.setImmediate = function setImmediate(func) {
+ return addTimer(clock, {
+ func: func,
+ args: Array.prototype.slice.call(arguments, 1),
+ immediate: true
+ });
+ };
+
+ clock.clearImmediate = function clearImmediate(timerId) {
+ clock.clearTimeout(timerId);
+ };
+
+ clock.tick = function tick(ms) {
+ ms = typeof ms == "number" ? ms : parseTime(ms);
+ var tickFrom = clock.now, tickTo = clock.now + ms, previous = clock.now;
+ var timer = firstTimerInRange(clock, tickFrom, tickTo);
+
+ var firstException;
+ while (timer && tickFrom <= tickTo) {
+ if (clock.timers[timer.id]) {
+ tickFrom = clock.now = timer.callAt;
+ try {
+ callTimer(clock, timer);
+ } catch (e) {
+ firstException = firstException || e;
+ }
+ }
+
+ timer = firstTimerInRange(clock, previous, tickTo);
+ previous = tickFrom;
+ }
+
+ clock.now = tickTo;
+
+ if (firstException) {
+ throw firstException;
+ }
+
+ return clock.now;
+ };
+
+ clock.reset = function reset() {
+ clock.timers = {};
+ };
+
+ return clock;
+};
+
+exports.install = function install(target, now, toFake) {
+ if (typeof target === "number") {
+ toFake = now;
+ now = target;
+ target = null;
+ }
+
+ if (!target) {
+ target = global;
+ }
+
+ var clock = createClock(now);
+
+ clock.uninstall = function () {
+ uninstall(clock, target);
+ };
+
+ clock.methods = toFake || [];
+
+ if (clock.methods.length === 0) {
+ clock.methods = keys(timers);
+ }
+
+ for (var i = 0, l = clock.methods.length; i < l; i++) {
+ hijackMethod(target, clock.methods[i], clock);
+ }
+
+ return clock;
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}]},{},[1])(1)
+});
+ })();
+ var define;
+/**
+ * Sinon core utilities. For internal use only.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+var sinon = (function () {
+"use strict";
+
+ var sinon;
+ var isNode = typeof module !== "undefined" && module.exports && typeof require === "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ sinon = module.exports = require("./sinon/util/core");
+ require("./sinon/extend");
+ require("./sinon/typeOf");
+ require("./sinon/times_in_words");
+ require("./sinon/spy");
+ require("./sinon/call");
+ require("./sinon/behavior");
+ require("./sinon/stub");
+ require("./sinon/mock");
+ require("./sinon/collection");
+ require("./sinon/assert");
+ require("./sinon/sandbox");
+ require("./sinon/test");
+ require("./sinon/test_case");
+ require("./sinon/match");
+ require("./sinon/format");
+ require("./sinon/log_error");
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ sinon = module.exports;
+ } else {
+ sinon = {};
+ }
+
+ return sinon;
+}());
+
+/**
+ * @depend ../../sinon.js
+ */
+/**
+ * Sinon core utilities. For internal use only.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+ var div = typeof document != "undefined" && document.createElement("div");
+ var hasOwn = Object.prototype.hasOwnProperty;
+
+ function isDOMNode(obj) {
+ var success = false;
+
+ try {
+ obj.appendChild(div);
+ success = div.parentNode == obj;
+ } catch (e) {
+ return false;
+ } finally {
+ try {
+ obj.removeChild(div);
+ } catch (e) {
+ // Remove failed, not much we can do about that
+ }
+ }
+
+ return success;
+ }
+
+ function isElement(obj) {
+ return div && obj && obj.nodeType === 1 && isDOMNode(obj);
+ }
+
+ function isFunction(obj) {
+ return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply);
+ }
+
+ function isReallyNaN(val) {
+ return typeof val === "number" && isNaN(val);
+ }
+
+ function mirrorProperties(target, source) {
+ for (var prop in source) {
+ if (!hasOwn.call(target, prop)) {
+ target[prop] = source[prop];
+ }
+ }
+ }
+
+ function isRestorable(obj) {
+ return typeof obj === "function" && typeof obj.restore === "function" && obj.restore.sinon;
+ }
+
+ // Cheap way to detect if we have ES5 support.
+ var hasES5Support = "keys" in Object;
+
+ function makeApi(sinon) {
+ sinon.wrapMethod = function wrapMethod(object, property, method) {
+ if (!object) {
+ throw new TypeError("Should wrap property of object");
+ }
+
+ if (typeof method != "function" && typeof method != "object") {
+ throw new TypeError("Method wrapper should be a function or a property descriptor");
+ }
+
+ function checkWrappedMethod(wrappedMethod) {
+ if (!isFunction(wrappedMethod)) {
+ error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " +
+ property + " as function");
+ } else if (wrappedMethod.restore && wrappedMethod.restore.sinon) {
+ error = new TypeError("Attempted to wrap " + property + " which is already wrapped");
+ } else if (wrappedMethod.calledBefore) {
+ var verb = !!wrappedMethod.returns ? "stubbed" : "spied on";
+ error = new TypeError("Attempted to wrap " + property + " which is already " + verb);
+ }
+
+ if (error) {
+ if (wrappedMethod && wrappedMethod.stackTrace) {
+ error.stack += "\n--------------\n" + wrappedMethod.stackTrace;
+ }
+ throw error;
+ }
+ }
+
+ var error, wrappedMethod;
+
+ // IE 8 does not support hasOwnProperty on the window object and Firefox has a problem
+ // when using hasOwn.call on objects from other frames.
+ var owned = object.hasOwnProperty ? object.hasOwnProperty(property) : hasOwn.call(object, property);
+
+ if (hasES5Support) {
+ var methodDesc = (typeof method == "function") ? {value: method} : method,
+ wrappedMethodDesc = sinon.getPropertyDescriptor(object, property),
+ i;
+
+ if (!wrappedMethodDesc) {
+ error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " +
+ property + " as function");
+ } else if (wrappedMethodDesc.restore && wrappedMethodDesc.restore.sinon) {
+ error = new TypeError("Attempted to wrap " + property + " which is already wrapped");
+ }
+ if (error) {
+ if (wrappedMethodDesc && wrappedMethodDesc.stackTrace) {
+ error.stack += "\n--------------\n" + wrappedMethodDesc.stackTrace;
+ }
+ throw error;
+ }
+
+ var types = sinon.objectKeys(methodDesc);
+ for (i = 0; i < types.length; i++) {
+ wrappedMethod = wrappedMethodDesc[types[i]];
+ checkWrappedMethod(wrappedMethod);
+ }
+
+ mirrorProperties(methodDesc, wrappedMethodDesc);
+ for (i = 0; i < types.length; i++) {
+ mirrorProperties(methodDesc[types[i]], wrappedMethodDesc[types[i]]);
+ }
+ Object.defineProperty(object, property, methodDesc);
+ } else {
+ wrappedMethod = object[property];
+ checkWrappedMethod(wrappedMethod);
+ object[property] = method;
+ method.displayName = property;
+ }
+
+ method.displayName = property;
+
+ // Set up a stack trace which can be used later to find what line of
+ // code the original method was created on.
+ method.stackTrace = (new Error("Stack Trace for original")).stack;
+
+ method.restore = function () {
+ // For prototype properties try to reset by delete first.
+ // If this fails (ex: localStorage on mobile safari) then force a reset
+ // via direct assignment.
+ if (!owned) {
+ // In some cases `delete` may throw an error
+ try {
+ delete object[property];
+ } catch (e) {}
+ // For native code functions `delete` fails without throwing an error
+ // on Chrome < 43, PhantomJS, etc.
+ } else if (hasES5Support) {
+ Object.defineProperty(object, property, wrappedMethodDesc);
+ }
+
+ // Use strict equality comparison to check failures then force a reset
+ // via direct assignment.
+ if (object[property] === method) {
+ object[property] = wrappedMethod;
+ }
+ };
+
+ method.restore.sinon = true;
+
+ if (!hasES5Support) {
+ mirrorProperties(method, wrappedMethod);
+ }
+
+ return method;
+ };
+
+ sinon.create = function create(proto) {
+ var F = function () {};
+ F.prototype = proto;
+ return new F();
+ };
+
+ sinon.deepEqual = function deepEqual(a, b) {
+ if (sinon.match && sinon.match.isMatcher(a)) {
+ return a.test(b);
+ }
+
+ if (typeof a != "object" || typeof b != "object") {
+ if (isReallyNaN(a) && isReallyNaN(b)) {
+ return true;
+ } else {
+ return a === b;
+ }
+ }
+
+ if (isElement(a) || isElement(b)) {
+ return a === b;
+ }
+
+ if (a === b) {
+ return true;
+ }
+
+ if ((a === null && b !== null) || (a !== null && b === null)) {
+ return false;
+ }
+
+ if (a instanceof RegExp && b instanceof RegExp) {
+ return (a.source === b.source) && (a.global === b.global) &&
+ (a.ignoreCase === b.ignoreCase) && (a.multiline === b.multiline);
+ }
+
+ var aString = Object.prototype.toString.call(a);
+ if (aString != Object.prototype.toString.call(b)) {
+ return false;
+ }
+
+ if (aString == "[object Date]") {
+ return a.valueOf() === b.valueOf();
+ }
+
+ var prop, aLength = 0, bLength = 0;
+
+ if (aString == "[object Array]" && a.length !== b.length) {
+ return false;
+ }
+
+ for (prop in a) {
+ aLength += 1;
+
+ if (!(prop in b)) {
+ return false;
+ }
+
+ if (!deepEqual(a[prop], b[prop])) {
+ return false;
+ }
+ }
+
+ for (prop in b) {
+ bLength += 1;
+ }
+
+ return aLength == bLength;
+ };
+
+ sinon.functionName = function functionName(func) {
+ var name = func.displayName || func.name;
+
+ // Use function decomposition as a last resort to get function
+ // name. Does not rely on function decomposition to work - if it
+ // doesn't debugging will be slightly less informative
+ // (i.e. toString will say 'spy' rather than 'myFunc').
+ if (!name) {
+ var matches = func.toString().match(/function ([^\s\(]+)/);
+ name = matches && matches[1];
+ }
+
+ return name;
+ };
+
+ sinon.functionToString = function toString() {
+ if (this.getCall && this.callCount) {
+ var thisValue, prop, i = this.callCount;
+
+ while (i--) {
+ thisValue = this.getCall(i).thisValue;
+
+ for (prop in thisValue) {
+ if (thisValue[prop] === this) {
+ return prop;
+ }
+ }
+ }
+ }
+
+ return this.displayName || "sinon fake";
+ };
+
+ sinon.objectKeys = function objectKeys(obj) {
+ if (obj !== Object(obj)) {
+ throw new TypeError("sinon.objectKeys called on a non-object");
+ }
+
+ var keys = [];
+ var key;
+ for (key in obj) {
+ if (hasOwn.call(obj, key)) {
+ keys.push(key);
+ }
+ }
+
+ return keys;
+ };
+
+ sinon.getPropertyDescriptor = function getPropertyDescriptor(object, property) {
+ var proto = object, descriptor;
+ while (proto && !(descriptor = Object.getOwnPropertyDescriptor(proto, property))) {
+ proto = Object.getPrototypeOf(proto);
+ }
+ return descriptor;
+ }
+
+ sinon.getConfig = function (custom) {
+ var config = {};
+ custom = custom || {};
+ var defaults = sinon.defaultConfig;
+
+ for (var prop in defaults) {
+ if (defaults.hasOwnProperty(prop)) {
+ config[prop] = custom.hasOwnProperty(prop) ? custom[prop] : defaults[prop];
+ }
+ }
+
+ return config;
+ };
+
+ sinon.defaultConfig = {
+ injectIntoThis: true,
+ injectInto: null,
+ properties: ["spy", "stub", "mock", "clock", "server", "requests"],
+ useFakeTimers: true,
+ useFakeServer: true
+ };
+
+ sinon.timesInWords = function timesInWords(count) {
+ return count == 1 && "once" ||
+ count == 2 && "twice" ||
+ count == 3 && "thrice" ||
+ (count || 0) + " times";
+ };
+
+ sinon.calledInOrder = function (spies) {
+ for (var i = 1, l = spies.length; i < l; i++) {
+ if (!spies[i - 1].calledBefore(spies[i]) || !spies[i].called) {
+ return false;
+ }
+ }
+
+ return true;
+ };
+
+ sinon.orderByFirstCall = function (spies) {
+ return spies.sort(function (a, b) {
+ // uuid, won't ever be equal
+ var aCall = a.getCall(0);
+ var bCall = b.getCall(0);
+ var aId = aCall && aCall.callId || -1;
+ var bId = bCall && bCall.callId || -1;
+
+ return aId < bId ? -1 : 1;
+ });
+ };
+
+ sinon.createStubInstance = function (constructor) {
+ if (typeof constructor !== "function") {
+ throw new TypeError("The constructor should be a function.");
+ }
+ return sinon.stub(sinon.create(constructor.prototype));
+ };
+
+ sinon.restore = function (object) {
+ if (object !== null && typeof object === "object") {
+ for (var prop in object) {
+ if (isRestorable(object[prop])) {
+ object[prop].restore();
+ }
+ }
+ } else if (isRestorable(object)) {
+ object.restore();
+ }
+ };
+
+ return sinon;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports) {
+ makeApi(exports);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend util/core.js
+ */
+
+(function (sinon) {
+ function makeApi(sinon) {
+
+ // Adapted from https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
+ var hasDontEnumBug = (function () {
+ var obj = {
+ constructor: function () {
+ return "0";
+ },
+ toString: function () {
+ return "1";
+ },
+ valueOf: function () {
+ return "2";
+ },
+ toLocaleString: function () {
+ return "3";
+ },
+ prototype: function () {
+ return "4";
+ },
+ isPrototypeOf: function () {
+ return "5";
+ },
+ propertyIsEnumerable: function () {
+ return "6";
+ },
+ hasOwnProperty: function () {
+ return "7";
+ },
+ length: function () {
+ return "8";
+ },
+ unique: function () {
+ return "9"
+ }
+ };
+
+ var result = [];
+ for (var prop in obj) {
+ result.push(obj[prop]());
+ }
+ return result.join("") !== "0123456789";
+ })();
+
+ /* Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will
+ * override properties in previous sources.
+ *
+ * target - The Object to extend
+ * sources - Objects to copy properties from.
+ *
+ * Returns the extended target
+ */
+ function extend(target /*, sources */) {
+ var sources = Array.prototype.slice.call(arguments, 1),
+ source, i, prop;
+
+ for (i = 0; i < sources.length; i++) {
+ source = sources[i];
+
+ for (prop in source) {
+ if (source.hasOwnProperty(prop)) {
+ target[prop] = source[prop];
+ }
+ }
+
+ // Make sure we copy (own) toString method even when in JScript with DontEnum bug
+ // See https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
+ if (hasDontEnumBug && source.hasOwnProperty("toString") && source.toString !== target.toString) {
+ target.toString = source.toString;
+ }
+ }
+
+ return target;
+ };
+
+ sinon.extend = extend;
+ return sinon.extend;
+ }
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ module.exports = makeApi(sinon);
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend util/core.js
+ */
+
+(function (sinon) {
+ function makeApi(sinon) {
+
+ function timesInWords(count) {
+ switch (count) {
+ case 1:
+ return "once";
+ case 2:
+ return "twice";
+ case 3:
+ return "thrice";
+ default:
+ return (count || 0) + " times";
+ }
+ }
+
+ sinon.timesInWords = timesInWords;
+ return sinon.timesInWords;
+ }
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ module.exports = makeApi(sinon);
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend util/core.js
+ */
+/**
+ * Format functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2014 Christian Johansen
+ */
+
+(function (sinon, formatio) {
+ function makeApi(sinon) {
+ function typeOf(value) {
+ if (value === null) {
+ return "null";
+ } else if (value === undefined) {
+ return "undefined";
+ }
+ var string = Object.prototype.toString.call(value);
+ return string.substring(8, string.length - 1).toLowerCase();
+ };
+
+ sinon.typeOf = typeOf;
+ return sinon.typeOf;
+ }
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ module.exports = makeApi(sinon);
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(
+ (typeof sinon == "object" && sinon || null),
+ (typeof formatio == "object" && formatio)
+));
+
+/**
+ * @depend util/core.js
+ * @depend typeOf.js
+ */
+/*jslint eqeqeq: false, onevar: false, plusplus: false*/
+/*global module, require, sinon*/
+/**
+ * Match functions
+ *
+ * @author Maximilian Antoni (mail@maxantoni.de)
+ * @license BSD
+ *
+ * Copyright (c) 2012 Maximilian Antoni
+ */
+
+(function (sinon) {
+ function makeApi(sinon) {
+ function assertType(value, type, name) {
+ var actual = sinon.typeOf(value);
+ if (actual !== type) {
+ throw new TypeError("Expected type of " + name + " to be " +
+ type + ", but was " + actual);
+ }
+ }
+
+ var matcher = {
+ toString: function () {
+ return this.message;
+ }
+ };
+
+ function isMatcher(object) {
+ return matcher.isPrototypeOf(object);
+ }
+
+ function matchObject(expectation, actual) {
+ if (actual === null || actual === undefined) {
+ return false;
+ }
+ for (var key in expectation) {
+ if (expectation.hasOwnProperty(key)) {
+ var exp = expectation[key];
+ var act = actual[key];
+ if (match.isMatcher(exp)) {
+ if (!exp.test(act)) {
+ return false;
+ }
+ } else if (sinon.typeOf(exp) === "object") {
+ if (!matchObject(exp, act)) {
+ return false;
+ }
+ } else if (!sinon.deepEqual(exp, act)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ matcher.or = function (m2) {
+ if (!arguments.length) {
+ throw new TypeError("Matcher expected");
+ } else if (!isMatcher(m2)) {
+ m2 = match(m2);
+ }
+ var m1 = this;
+ var or = sinon.create(matcher);
+ or.test = function (actual) {
+ return m1.test(actual) || m2.test(actual);
+ };
+ or.message = m1.message + ".or(" + m2.message + ")";
+ return or;
+ };
+
+ matcher.and = function (m2) {
+ if (!arguments.length) {
+ throw new TypeError("Matcher expected");
+ } else if (!isMatcher(m2)) {
+ m2 = match(m2);
+ }
+ var m1 = this;
+ var and = sinon.create(matcher);
+ and.test = function (actual) {
+ return m1.test(actual) && m2.test(actual);
+ };
+ and.message = m1.message + ".and(" + m2.message + ")";
+ return and;
+ };
+
+ var match = function (expectation, message) {
+ var m = sinon.create(matcher);
+ var type = sinon.typeOf(expectation);
+ switch (type) {
+ case "object":
+ if (typeof expectation.test === "function") {
+ m.test = function (actual) {
+ return expectation.test(actual) === true;
+ };
+ m.message = "match(" + sinon.functionName(expectation.test) + ")";
+ return m;
+ }
+ var str = [];
+ for (var key in expectation) {
+ if (expectation.hasOwnProperty(key)) {
+ str.push(key + ": " + expectation[key]);
+ }
+ }
+ m.test = function (actual) {
+ return matchObject(expectation, actual);
+ };
+ m.message = "match(" + str.join(", ") + ")";
+ break;
+ case "number":
+ m.test = function (actual) {
+ return expectation == actual;
+ };
+ break;
+ case "string":
+ m.test = function (actual) {
+ if (typeof actual !== "string") {
+ return false;
+ }
+ return actual.indexOf(expectation) !== -1;
+ };
+ m.message = "match(\"" + expectation + "\")";
+ break;
+ case "regexp":
+ m.test = function (actual) {
+ if (typeof actual !== "string") {
+ return false;
+ }
+ return expectation.test(actual);
+ };
+ break;
+ case "function":
+ m.test = expectation;
+ if (message) {
+ m.message = message;
+ } else {
+ m.message = "match(" + sinon.functionName(expectation) + ")";
+ }
+ break;
+ default:
+ m.test = function (actual) {
+ return sinon.deepEqual(expectation, actual);
+ };
+ }
+ if (!m.message) {
+ m.message = "match(" + expectation + ")";
+ }
+ return m;
+ };
+
+ match.isMatcher = isMatcher;
+
+ match.any = match(function () {
+ return true;
+ }, "any");
+
+ match.defined = match(function (actual) {
+ return actual !== null && actual !== undefined;
+ }, "defined");
+
+ match.truthy = match(function (actual) {
+ return !!actual;
+ }, "truthy");
+
+ match.falsy = match(function (actual) {
+ return !actual;
+ }, "falsy");
+
+ match.same = function (expectation) {
+ return match(function (actual) {
+ return expectation === actual;
+ }, "same(" + expectation + ")");
+ };
+
+ match.typeOf = function (type) {
+ assertType(type, "string", "type");
+ return match(function (actual) {
+ return sinon.typeOf(actual) === type;
+ }, "typeOf(\"" + type + "\")");
+ };
+
+ match.instanceOf = function (type) {
+ assertType(type, "function", "type");
+ return match(function (actual) {
+ return actual instanceof type;
+ }, "instanceOf(" + sinon.functionName(type) + ")");
+ };
+
+ function createPropertyMatcher(propertyTest, messagePrefix) {
+ return function (property, value) {
+ assertType(property, "string", "property");
+ var onlyProperty = arguments.length === 1;
+ var message = messagePrefix + "(\"" + property + "\"";
+ if (!onlyProperty) {
+ message += ", " + value;
+ }
+ message += ")";
+ return match(function (actual) {
+ if (actual === undefined || actual === null ||
+ !propertyTest(actual, property)) {
+ return false;
+ }
+ return onlyProperty || sinon.deepEqual(value, actual[property]);
+ }, message);
+ };
+ }
+
+ match.has = createPropertyMatcher(function (actual, property) {
+ if (typeof actual === "object") {
+ return property in actual;
+ }
+ return actual[property] !== undefined;
+ }, "has");
+
+ match.hasOwn = createPropertyMatcher(function (actual, property) {
+ return actual.hasOwnProperty(property);
+ }, "hasOwn");
+
+ match.bool = match.typeOf("boolean");
+ match.number = match.typeOf("number");
+ match.string = match.typeOf("string");
+ match.object = match.typeOf("object");
+ match.func = match.typeOf("function");
+ match.array = match.typeOf("array");
+ match.regexp = match.typeOf("regexp");
+ match.date = match.typeOf("date");
+
+ sinon.match = match;
+ return match;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./typeOf");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend util/core.js
+ */
+/**
+ * Format functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2014 Christian Johansen
+ */
+
+(function (sinon, formatio) {
+ function makeApi(sinon) {
+ function valueFormatter(value) {
+ return "" + value;
+ }
+
+ function getFormatioFormatter() {
+ var formatter = formatio.configure({
+ quoteStrings: false,
+ limitChildrenCount: 250
+ });
+
+ function format() {
+ return formatter.ascii.apply(formatter, arguments);
+ };
+
+ return format;
+ }
+
+ function getNodeFormatter(value) {
+ function format(value) {
+ return typeof value == "object" && value.toString === Object.prototype.toString ? util.inspect(value) : value;
+ };
+
+ try {
+ var util = require("util");
+ } catch (e) {
+ /* Node, but no util module - would be very old, but better safe than sorry */
+ }
+
+ return util ? format : valueFormatter;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function",
+ formatter;
+
+ if (isNode) {
+ try {
+ formatio = require("formatio");
+ } catch (e) {}
+ }
+
+ if (formatio) {
+ formatter = getFormatioFormatter()
+ } else if (isNode) {
+ formatter = getNodeFormatter();
+ } else {
+ formatter = valueFormatter;
+ }
+
+ sinon.format = formatter;
+ return sinon.format;
+ }
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ module.exports = makeApi(sinon);
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(
+ (typeof sinon == "object" && sinon || null),
+ (typeof formatio == "object" && formatio)
+));
+
+/**
+ * @depend util/core.js
+ * @depend match.js
+ * @depend format.js
+ */
+/**
+ * Spy calls
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @author Maximilian Antoni (mail@maxantoni.de)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ * Copyright (c) 2013 Maximilian Antoni
+ */
+
+(function (sinon) {
+ function makeApi(sinon) {
+ function throwYieldError(proxy, text, args) {
+ var msg = sinon.functionName(proxy) + text;
+ if (args.length) {
+ msg += " Received [" + slice.call(args).join(", ") + "]";
+ }
+ throw new Error(msg);
+ }
+
+ var slice = Array.prototype.slice;
+
+ var callProto = {
+ calledOn: function calledOn(thisValue) {
+ if (sinon.match && sinon.match.isMatcher(thisValue)) {
+ return thisValue.test(this.thisValue);
+ }
+ return this.thisValue === thisValue;
+ },
+
+ calledWith: function calledWith() {
+ var l = arguments.length;
+ if (l > this.args.length) {
+ return false;
+ }
+ for (var i = 0; i < l; i += 1) {
+ if (!sinon.deepEqual(arguments[i], this.args[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ },
+
+ calledWithMatch: function calledWithMatch() {
+ var l = arguments.length;
+ if (l > this.args.length) {
+ return false;
+ }
+ for (var i = 0; i < l; i += 1) {
+ var actual = this.args[i];
+ var expectation = arguments[i];
+ if (!sinon.match || !sinon.match(expectation).test(actual)) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ calledWithExactly: function calledWithExactly() {
+ return arguments.length == this.args.length &&
+ this.calledWith.apply(this, arguments);
+ },
+
+ notCalledWith: function notCalledWith() {
+ return !this.calledWith.apply(this, arguments);
+ },
+
+ notCalledWithMatch: function notCalledWithMatch() {
+ return !this.calledWithMatch.apply(this, arguments);
+ },
+
+ returned: function returned(value) {
+ return sinon.deepEqual(value, this.returnValue);
+ },
+
+ threw: function threw(error) {
+ if (typeof error === "undefined" || !this.exception) {
+ return !!this.exception;
+ }
+
+ return this.exception === error || this.exception.name === error;
+ },
+
+ calledWithNew: function calledWithNew() {
+ return this.proxy.prototype && this.thisValue instanceof this.proxy;
+ },
+
+ calledBefore: function (other) {
+ return this.callId < other.callId;
+ },
+
+ calledAfter: function (other) {
+ return this.callId > other.callId;
+ },
+
+ callArg: function (pos) {
+ this.args[pos]();
+ },
+
+ callArgOn: function (pos, thisValue) {
+ this.args[pos].apply(thisValue);
+ },
+
+ callArgWith: function (pos) {
+ this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1)));
+ },
+
+ callArgOnWith: function (pos, thisValue) {
+ var args = slice.call(arguments, 2);
+ this.args[pos].apply(thisValue, args);
+ },
+
+ yield: function () {
+ this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0)));
+ },
+
+ yieldOn: function (thisValue) {
+ var args = this.args;
+ for (var i = 0, l = args.length; i < l; ++i) {
+ if (typeof args[i] === "function") {
+ args[i].apply(thisValue, slice.call(arguments, 1));
+ return;
+ }
+ }
+ throwYieldError(this.proxy, " cannot yield since no callback was passed.", args);
+ },
+
+ yieldTo: function (prop) {
+ this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1)));
+ },
+
+ yieldToOn: function (prop, thisValue) {
+ var args = this.args;
+ for (var i = 0, l = args.length; i < l; ++i) {
+ if (args[i] && typeof args[i][prop] === "function") {
+ args[i][prop].apply(thisValue, slice.call(arguments, 2));
+ return;
+ }
+ }
+ throwYieldError(this.proxy, " cannot yield to '" + prop +
+ "' since no callback was passed.", args);
+ },
+
+ toString: function () {
+ var callStr = this.proxy.toString() + "(";
+ var args = [];
+
+ for (var i = 0, l = this.args.length; i < l; ++i) {
+ args.push(sinon.format(this.args[i]));
+ }
+
+ callStr = callStr + args.join(", ") + ")";
+
+ if (typeof this.returnValue != "undefined") {
+ callStr += " => " + sinon.format(this.returnValue);
+ }
+
+ if (this.exception) {
+ callStr += " !" + this.exception.name;
+
+ if (this.exception.message) {
+ callStr += "(" + this.exception.message + ")";
+ }
+ }
+
+ return callStr;
+ }
+ };
+
+ callProto.invokeCallback = callProto.yield;
+
+ function createSpyCall(spy, thisValue, args, returnValue, exception, id) {
+ if (typeof id !== "number") {
+ throw new TypeError("Call id is not a number");
+ }
+ var proxyCall = sinon.create(callProto);
+ proxyCall.proxy = spy;
+ proxyCall.thisValue = thisValue;
+ proxyCall.args = args;
+ proxyCall.returnValue = returnValue;
+ proxyCall.exception = exception;
+ proxyCall.callId = id;
+
+ return proxyCall;
+ }
+ createSpyCall.toString = callProto.toString; // used by mocks
+
+ sinon.spyCall = createSpyCall;
+ return createSpyCall;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./match");
+ require("./format");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend times_in_words.js
+ * @depend util/core.js
+ * @depend extend.js
+ * @depend call.js
+ * @depend format.js
+ */
+/**
+ * Spy functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+
+ function makeApi(sinon) {
+ var push = Array.prototype.push;
+ var slice = Array.prototype.slice;
+ var callId = 0;
+
+ function spy(object, property, types) {
+ if (!property && typeof object == "function") {
+ return spy.create(object);
+ }
+
+ if (!object && !property) {
+ return spy.create(function () { });
+ }
+
+ if (types) {
+ var methodDesc = sinon.getPropertyDescriptor(object, property);
+ for (var i = 0; i < types.length; i++) {
+ methodDesc[types[i]] = spy.create(methodDesc[types[i]]);
+ }
+ return sinon.wrapMethod(object, property, methodDesc);
+ } else {
+ var method = object[property];
+ return sinon.wrapMethod(object, property, spy.create(method));
+ }
+ }
+
+ function matchingFake(fakes, args, strict) {
+ if (!fakes) {
+ return;
+ }
+
+ for (var i = 0, l = fakes.length; i < l; i++) {
+ if (fakes[i].matches(args, strict)) {
+ return fakes[i];
+ }
+ }
+ }
+
+ function incrementCallCount() {
+ this.called = true;
+ this.callCount += 1;
+ this.notCalled = false;
+ this.calledOnce = this.callCount == 1;
+ this.calledTwice = this.callCount == 2;
+ this.calledThrice = this.callCount == 3;
+ }
+
+ function createCallProperties() {
+ this.firstCall = this.getCall(0);
+ this.secondCall = this.getCall(1);
+ this.thirdCall = this.getCall(2);
+ this.lastCall = this.getCall(this.callCount - 1);
+ }
+
+ var vars = "a,b,c,d,e,f,g,h,i,j,k,l";
+ function createProxy(func, proxyLength) {
+ // Retain the function length:
+ var p;
+ if (proxyLength) {
+ eval("p = (function proxy(" + vars.substring(0, proxyLength * 2 - 1) +
+ ") { return p.invoke(func, this, slice.call(arguments)); });");
+ } else {
+ p = function proxy() {
+ return p.invoke(func, this, slice.call(arguments));
+ };
+ }
+ p.isSinonProxy = true;
+ return p;
+ }
+
+ var uuid = 0;
+
+ // Public API
+ var spyApi = {
+ reset: function () {
+ if (this.invoking) {
+ var err = new Error("Cannot reset Sinon function while invoking it. " +
+ "Move the call to .reset outside of the callback.");
+ err.name = "InvalidResetException";
+ throw err;
+ }
+
+ this.called = false;
+ this.notCalled = true;
+ this.calledOnce = false;
+ this.calledTwice = false;
+ this.calledThrice = false;
+ this.callCount = 0;
+ this.firstCall = null;
+ this.secondCall = null;
+ this.thirdCall = null;
+ this.lastCall = null;
+ this.args = [];
+ this.returnValues = [];
+ this.thisValues = [];
+ this.exceptions = [];
+ this.callIds = [];
+ if (this.fakes) {
+ for (var i = 0; i < this.fakes.length; i++) {
+ this.fakes[i].reset();
+ }
+ }
+
+ return this;
+ },
+
+ create: function create(func, spyLength) {
+ var name;
+
+ if (typeof func != "function") {
+ func = function () { };
+ } else {
+ name = sinon.functionName(func);
+ }
+
+ if (!spyLength) {
+ spyLength = func.length;
+ }
+
+ var proxy = createProxy(func, spyLength);
+
+ sinon.extend(proxy, spy);
+ delete proxy.create;
+ sinon.extend(proxy, func);
+
+ proxy.reset();
+ proxy.prototype = func.prototype;
+ proxy.displayName = name || "spy";
+ proxy.toString = sinon.functionToString;
+ proxy.instantiateFake = sinon.spy.create;
+ proxy.id = "spy#" + uuid++;
+
+ return proxy;
+ },
+
+ invoke: function invoke(func, thisValue, args) {
+ var matching = matchingFake(this.fakes, args);
+ var exception, returnValue;
+
+ incrementCallCount.call(this);
+ push.call(this.thisValues, thisValue);
+ push.call(this.args, args);
+ push.call(this.callIds, callId++);
+
+ // Make call properties available from within the spied function:
+ createCallProperties.call(this);
+
+ try {
+ this.invoking = true;
+
+ if (matching) {
+ returnValue = matching.invoke(func, thisValue, args);
+ } else {
+ returnValue = (this.func || func).apply(thisValue, args);
+ }
+
+ var thisCall = this.getCall(this.callCount - 1);
+ if (thisCall.calledWithNew() && typeof returnValue !== "object") {
+ returnValue = thisValue;
+ }
+ } catch (e) {
+ exception = e;
+ } finally {
+ delete this.invoking;
+ }
+
+ push.call(this.exceptions, exception);
+ push.call(this.returnValues, returnValue);
+
+ // Make return value and exception available in the calls:
+ createCallProperties.call(this);
+
+ if (exception !== undefined) {
+ throw exception;
+ }
+
+ return returnValue;
+ },
+
+ named: function named(name) {
+ this.displayName = name;
+ return this;
+ },
+
+ getCall: function getCall(i) {
+ if (i < 0 || i >= this.callCount) {
+ return null;
+ }
+
+ return sinon.spyCall(this, this.thisValues[i], this.args[i],
+ this.returnValues[i], this.exceptions[i],
+ this.callIds[i]);
+ },
+
+ getCalls: function () {
+ var calls = [];
+ var i;
+
+ for (i = 0; i < this.callCount; i++) {
+ calls.push(this.getCall(i));
+ }
+
+ return calls;
+ },
+
+ calledBefore: function calledBefore(spyFn) {
+ if (!this.called) {
+ return false;
+ }
+
+ if (!spyFn.called) {
+ return true;
+ }
+
+ return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1];
+ },
+
+ calledAfter: function calledAfter(spyFn) {
+ if (!this.called || !spyFn.called) {
+ return false;
+ }
+
+ return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1];
+ },
+
+ withArgs: function () {
+ var args = slice.call(arguments);
+
+ if (this.fakes) {
+ var match = matchingFake(this.fakes, args, true);
+
+ if (match) {
+ return match;
+ }
+ } else {
+ this.fakes = [];
+ }
+
+ var original = this;
+ var fake = this.instantiateFake();
+ fake.matchingAguments = args;
+ fake.parent = this;
+ push.call(this.fakes, fake);
+
+ fake.withArgs = function () {
+ return original.withArgs.apply(original, arguments);
+ };
+
+ for (var i = 0; i < this.args.length; i++) {
+ if (fake.matches(this.args[i])) {
+ incrementCallCount.call(fake);
+ push.call(fake.thisValues, this.thisValues[i]);
+ push.call(fake.args, this.args[i]);
+ push.call(fake.returnValues, this.returnValues[i]);
+ push.call(fake.exceptions, this.exceptions[i]);
+ push.call(fake.callIds, this.callIds[i]);
+ }
+ }
+ createCallProperties.call(fake);
+
+ return fake;
+ },
+
+ matches: function (args, strict) {
+ var margs = this.matchingAguments;
+
+ if (margs.length <= args.length &&
+ sinon.deepEqual(margs, args.slice(0, margs.length))) {
+ return !strict || margs.length == args.length;
+ }
+ },
+
+ printf: function (format) {
+ var spy = this;
+ var args = slice.call(arguments, 1);
+ var formatter;
+
+ return (format || "").replace(/%(.)/g, function (match, specifyer) {
+ formatter = spyApi.formatters[specifyer];
+
+ if (typeof formatter == "function") {
+ return formatter.call(null, spy, args);
+ } else if (!isNaN(parseInt(specifyer, 10))) {
+ return sinon.format(args[specifyer - 1]);
+ }
+
+ return "%" + specifyer;
+ });
+ }
+ };
+
+ function delegateToCalls(method, matchAny, actual, notCalled) {
+ spyApi[method] = function () {
+ if (!this.called) {
+ if (notCalled) {
+ return notCalled.apply(this, arguments);
+ }
+ return false;
+ }
+
+ var currentCall;
+ var matches = 0;
+
+ for (var i = 0, l = this.callCount; i < l; i += 1) {
+ currentCall = this.getCall(i);
+
+ if (currentCall[actual || method].apply(currentCall, arguments)) {
+ matches += 1;
+
+ if (matchAny) {
+ return true;
+ }
+ }
+ }
+
+ return matches === this.callCount;
+ };
+ }
+
+ delegateToCalls("calledOn", true);
+ delegateToCalls("alwaysCalledOn", false, "calledOn");
+ delegateToCalls("calledWith", true);
+ delegateToCalls("calledWithMatch", true);
+ delegateToCalls("alwaysCalledWith", false, "calledWith");
+ delegateToCalls("alwaysCalledWithMatch", false, "calledWithMatch");
+ delegateToCalls("calledWithExactly", true);
+ delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly");
+ delegateToCalls("neverCalledWith", false, "notCalledWith", function () {
+ return true;
+ });
+ delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch", function () {
+ return true;
+ });
+ delegateToCalls("threw", true);
+ delegateToCalls("alwaysThrew", false, "threw");
+ delegateToCalls("returned", true);
+ delegateToCalls("alwaysReturned", false, "returned");
+ delegateToCalls("calledWithNew", true);
+ delegateToCalls("alwaysCalledWithNew", false, "calledWithNew");
+ delegateToCalls("callArg", false, "callArgWith", function () {
+ throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
+ });
+ spyApi.callArgWith = spyApi.callArg;
+ delegateToCalls("callArgOn", false, "callArgOnWith", function () {
+ throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
+ });
+ spyApi.callArgOnWith = spyApi.callArgOn;
+ delegateToCalls("yield", false, "yield", function () {
+ throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
+ });
+ // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode.
+ spyApi.invokeCallback = spyApi.yield;
+ delegateToCalls("yieldOn", false, "yieldOn", function () {
+ throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
+ });
+ delegateToCalls("yieldTo", false, "yieldTo", function (property) {
+ throw new Error(this.toString() + " cannot yield to '" + property +
+ "' since it was not yet invoked.");
+ });
+ delegateToCalls("yieldToOn", false, "yieldToOn", function (property) {
+ throw new Error(this.toString() + " cannot yield to '" + property +
+ "' since it was not yet invoked.");
+ });
+
+ spyApi.formatters = {
+ c: function (spy) {
+ return sinon.timesInWords(spy.callCount);
+ },
+
+ n: function (spy) {
+ return spy.toString();
+ },
+
+ C: function (spy) {
+ var calls = [];
+
+ for (var i = 0, l = spy.callCount; i < l; ++i) {
+ var stringifiedCall = " " + spy.getCall(i).toString();
+ if (/\n/.test(calls[i - 1])) {
+ stringifiedCall = "\n" + stringifiedCall;
+ }
+ push.call(calls, stringifiedCall);
+ }
+
+ return calls.length > 0 ? "\n" + calls.join("\n") : "";
+ },
+
+ t: function (spy) {
+ var objects = [];
+
+ for (var i = 0, l = spy.callCount; i < l; ++i) {
+ push.call(objects, sinon.format(spy.thisValues[i]));
+ }
+
+ return objects.join(", ");
+ },
+
+ "*": function (spy, args) {
+ var formatted = [];
+
+ for (var i = 0, l = args.length; i < l; ++i) {
+ push.call(formatted, sinon.format(args[i]));
+ }
+
+ return formatted.join(", ");
+ }
+ };
+
+ sinon.extend(spy, spyApi);
+
+ spy.spyCall = sinon.spyCall;
+ sinon.spy = spy;
+
+ return spy;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./call");
+ require("./extend");
+ require("./times_in_words");
+ require("./format");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend util/core.js
+ * @depend extend.js
+ */
+/**
+ * Stub behavior
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @author Tim Fischbach (mail@timfischbach.de)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+ var slice = Array.prototype.slice;
+ var join = Array.prototype.join;
+ var useLeftMostCallback = -1;
+ var useRightMostCallback = -2;
+
+ var nextTick = (function () {
+ if (typeof process === "object" && typeof process.nextTick === "function") {
+ return process.nextTick;
+ } else if (typeof setImmediate === "function") {
+ return setImmediate;
+ } else {
+ return function (callback) {
+ setTimeout(callback, 0);
+ };
+ }
+ })();
+
+ function throwsException(error, message) {
+ if (typeof error == "string") {
+ this.exception = new Error(message || "");
+ this.exception.name = error;
+ } else if (!error) {
+ this.exception = new Error("Error");
+ } else {
+ this.exception = error;
+ }
+
+ return this;
+ }
+
+ function getCallback(behavior, args) {
+ var callArgAt = behavior.callArgAt;
+
+ if (callArgAt >= 0) {
+ return args[callArgAt];
+ }
+
+ var argumentList;
+
+ if (callArgAt === useLeftMostCallback) {
+ argumentList = args;
+ }
+
+ if (callArgAt === useRightMostCallback) {
+ argumentList = slice.call(args).reverse();
+ }
+
+ var callArgProp = behavior.callArgProp;
+
+ for (var i = 0, l = argumentList.length; i < l; ++i) {
+ if (!callArgProp && typeof argumentList[i] == "function") {
+ return argumentList[i];
+ }
+
+ if (callArgProp && argumentList[i] &&
+ typeof argumentList[i][callArgProp] == "function") {
+ return argumentList[i][callArgProp];
+ }
+ }
+
+ return null;
+ }
+
+ function makeApi(sinon) {
+ function getCallbackError(behavior, func, args) {
+ if (behavior.callArgAt < 0) {
+ var msg;
+
+ if (behavior.callArgProp) {
+ msg = sinon.functionName(behavior.stub) +
+ " expected to yield to '" + behavior.callArgProp +
+ "', but no object with such a property was passed.";
+ } else {
+ msg = sinon.functionName(behavior.stub) +
+ " expected to yield, but no callback was passed.";
+ }
+
+ if (args.length > 0) {
+ msg += " Received [" + join.call(args, ", ") + "]";
+ }
+
+ return msg;
+ }
+
+ return "argument at index " + behavior.callArgAt + " is not a function: " + func;
+ }
+
+ function callCallback(behavior, args) {
+ if (typeof behavior.callArgAt == "number") {
+ var func = getCallback(behavior, args);
+
+ if (typeof func != "function") {
+ throw new TypeError(getCallbackError(behavior, func, args));
+ }
+
+ if (behavior.callbackAsync) {
+ nextTick(function () {
+ func.apply(behavior.callbackContext, behavior.callbackArguments);
+ });
+ } else {
+ func.apply(behavior.callbackContext, behavior.callbackArguments);
+ }
+ }
+ }
+
+ var proto = {
+ create: function create(stub) {
+ var behavior = sinon.extend({}, sinon.behavior);
+ delete behavior.create;
+ behavior.stub = stub;
+
+ return behavior;
+ },
+
+ isPresent: function isPresent() {
+ return (typeof this.callArgAt == "number" ||
+ this.exception ||
+ typeof this.returnArgAt == "number" ||
+ this.returnThis ||
+ this.returnValueDefined);
+ },
+
+ invoke: function invoke(context, args) {
+ callCallback(this, args);
+
+ if (this.exception) {
+ throw this.exception;
+ } else if (typeof this.returnArgAt == "number") {
+ return args[this.returnArgAt];
+ } else if (this.returnThis) {
+ return context;
+ }
+
+ return this.returnValue;
+ },
+
+ onCall: function onCall(index) {
+ return this.stub.onCall(index);
+ },
+
+ onFirstCall: function onFirstCall() {
+ return this.stub.onFirstCall();
+ },
+
+ onSecondCall: function onSecondCall() {
+ return this.stub.onSecondCall();
+ },
+
+ onThirdCall: function onThirdCall() {
+ return this.stub.onThirdCall();
+ },
+
+ withArgs: function withArgs(/* arguments */) {
+ throw new Error("Defining a stub by invoking \"stub.onCall(...).withArgs(...)\" is not supported. " +
+ "Use \"stub.withArgs(...).onCall(...)\" to define sequential behavior for calls with certain arguments.");
+ },
+
+ callsArg: function callsArg(pos) {
+ if (typeof pos != "number") {
+ throw new TypeError("argument index is not number");
+ }
+
+ this.callArgAt = pos;
+ this.callbackArguments = [];
+ this.callbackContext = undefined;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ callsArgOn: function callsArgOn(pos, context) {
+ if (typeof pos != "number") {
+ throw new TypeError("argument index is not number");
+ }
+ if (typeof context != "object") {
+ throw new TypeError("argument context is not an object");
+ }
+
+ this.callArgAt = pos;
+ this.callbackArguments = [];
+ this.callbackContext = context;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ callsArgWith: function callsArgWith(pos) {
+ if (typeof pos != "number") {
+ throw new TypeError("argument index is not number");
+ }
+
+ this.callArgAt = pos;
+ this.callbackArguments = slice.call(arguments, 1);
+ this.callbackContext = undefined;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ callsArgOnWith: function callsArgWith(pos, context) {
+ if (typeof pos != "number") {
+ throw new TypeError("argument index is not number");
+ }
+ if (typeof context != "object") {
+ throw new TypeError("argument context is not an object");
+ }
+
+ this.callArgAt = pos;
+ this.callbackArguments = slice.call(arguments, 2);
+ this.callbackContext = context;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ yields: function () {
+ this.callArgAt = useLeftMostCallback;
+ this.callbackArguments = slice.call(arguments, 0);
+ this.callbackContext = undefined;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ yieldsRight: function () {
+ this.callArgAt = useRightMostCallback;
+ this.callbackArguments = slice.call(arguments, 0);
+ this.callbackContext = undefined;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ yieldsOn: function (context) {
+ if (typeof context != "object") {
+ throw new TypeError("argument context is not an object");
+ }
+
+ this.callArgAt = useLeftMostCallback;
+ this.callbackArguments = slice.call(arguments, 1);
+ this.callbackContext = context;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ yieldsTo: function (prop) {
+ this.callArgAt = useLeftMostCallback;
+ this.callbackArguments = slice.call(arguments, 1);
+ this.callbackContext = undefined;
+ this.callArgProp = prop;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ yieldsToOn: function (prop, context) {
+ if (typeof context != "object") {
+ throw new TypeError("argument context is not an object");
+ }
+
+ this.callArgAt = useLeftMostCallback;
+ this.callbackArguments = slice.call(arguments, 2);
+ this.callbackContext = context;
+ this.callArgProp = prop;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ throws: throwsException,
+ throwsException: throwsException,
+
+ returns: function returns(value) {
+ this.returnValue = value;
+ this.returnValueDefined = true;
+
+ return this;
+ },
+
+ returnsArg: function returnsArg(pos) {
+ if (typeof pos != "number") {
+ throw new TypeError("argument index is not number");
+ }
+
+ this.returnArgAt = pos;
+
+ return this;
+ },
+
+ returnsThis: function returnsThis() {
+ this.returnThis = true;
+
+ return this;
+ }
+ };
+
+ // create asynchronous versions of callsArg* and yields* methods
+ for (var method in proto) {
+ // need to avoid creating anotherasync versions of the newly added async methods
+ if (proto.hasOwnProperty(method) &&
+ method.match(/^(callsArg|yields)/) &&
+ !method.match(/Async/)) {
+ proto[method + "Async"] = (function (syncFnName) {
+ return function () {
+ var result = this[syncFnName].apply(this, arguments);
+ this.callbackAsync = true;
+ return result;
+ };
+ })(method);
+ }
+ }
+
+ sinon.behavior = proto;
+ return proto;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./extend");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend util/core.js
+ * @depend extend.js
+ * @depend spy.js
+ * @depend behavior.js
+ */
+/**
+ * Stub functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+ function makeApi(sinon) {
+ function stub(object, property, func) {
+ if (!!func && typeof func != "function" && typeof func != "object") {
+ throw new TypeError("Custom stub should be a function or a property descriptor");
+ }
+
+ var wrapper;
+
+ if (func) {
+ if (typeof func == "function") {
+ wrapper = sinon.spy && sinon.spy.create ? sinon.spy.create(func) : func;
+ } else {
+ wrapper = func;
+ if (sinon.spy && sinon.spy.create) {
+ var types = sinon.objectKeys(wrapper);
+ for (var i = 0; i < types.length; i++) {
+ wrapper[types[i]] = sinon.spy.create(wrapper[types[i]]);
+ }
+ }
+ }
+ } else {
+ var stubLength = 0;
+ if (typeof object == "object" && typeof object[property] == "function") {
+ stubLength = object[property].length;
+ }
+ wrapper = stub.create(stubLength);
+ }
+
+ if (!object && typeof property === "undefined") {
+ return sinon.stub.create();
+ }
+
+ if (typeof property === "undefined" && typeof object == "object") {
+ for (var prop in object) {
+ if (typeof sinon.getPropertyDescriptor(object, prop).value === "function") {
+ stub(object, prop);
+ }
+ }
+
+ return object;
+ }
+
+ return sinon.wrapMethod(object, property, wrapper);
+ }
+
+ function getDefaultBehavior(stub) {
+ return stub.defaultBehavior || getParentBehaviour(stub) || sinon.behavior.create(stub);
+ }
+
+ function getParentBehaviour(stub) {
+ return (stub.parent && getCurrentBehavior(stub.parent));
+ }
+
+ function getCurrentBehavior(stub) {
+ var behavior = stub.behaviors[stub.callCount - 1];
+ return behavior && behavior.isPresent() ? behavior : getDefaultBehavior(stub);
+ }
+
+ var uuid = 0;
+
+ var proto = {
+ create: function create(stubLength) {
+ var functionStub = function () {
+ return getCurrentBehavior(functionStub).invoke(this, arguments);
+ };
+
+ functionStub.id = "stub#" + uuid++;
+ var orig = functionStub;
+ functionStub = sinon.spy.create(functionStub, stubLength);
+ functionStub.func = orig;
+
+ sinon.extend(functionStub, stub);
+ functionStub.instantiateFake = sinon.stub.create;
+ functionStub.displayName = "stub";
+ functionStub.toString = sinon.functionToString;
+
+ functionStub.defaultBehavior = null;
+ functionStub.behaviors = [];
+
+ return functionStub;
+ },
+
+ resetBehavior: function () {
+ var i;
+
+ this.defaultBehavior = null;
+ this.behaviors = [];
+
+ delete this.returnValue;
+ delete this.returnArgAt;
+ this.returnThis = false;
+
+ if (this.fakes) {
+ for (i = 0; i < this.fakes.length; i++) {
+ this.fakes[i].resetBehavior();
+ }
+ }
+ },
+
+ onCall: function onCall(index) {
+ if (!this.behaviors[index]) {
+ this.behaviors[index] = sinon.behavior.create(this);
+ }
+
+ return this.behaviors[index];
+ },
+
+ onFirstCall: function onFirstCall() {
+ return this.onCall(0);
+ },
+
+ onSecondCall: function onSecondCall() {
+ return this.onCall(1);
+ },
+
+ onThirdCall: function onThirdCall() {
+ return this.onCall(2);
+ }
+ };
+
+ for (var method in sinon.behavior) {
+ if (sinon.behavior.hasOwnProperty(method) &&
+ !proto.hasOwnProperty(method) &&
+ method != "create" &&
+ method != "withArgs" &&
+ method != "invoke") {
+ proto[method] = (function (behaviorMethod) {
+ return function () {
+ this.defaultBehavior = this.defaultBehavior || sinon.behavior.create(this);
+ this.defaultBehavior[behaviorMethod].apply(this.defaultBehavior, arguments);
+ return this;
+ };
+ }(method));
+ }
+ }
+
+ sinon.extend(stub, proto);
+ sinon.stub = stub;
+
+ return stub;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./behavior");
+ require("./spy");
+ require("./extend");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend times_in_words.js
+ * @depend util/core.js
+ * @depend call.js
+ * @depend extend.js
+ * @depend match.js
+ * @depend spy.js
+ * @depend stub.js
+ * @depend format.js
+ */
+/**
+ * Mock functions.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+ function makeApi(sinon) {
+ var push = [].push;
+ var match = sinon.match;
+
+ function mock(object) {
+ // if (typeof console !== undefined && console.warn) {
+ // console.warn("mock will be removed from Sinon.JS v2.0");
+ // }
+
+ if (!object) {
+ return sinon.expectation.create("Anonymous mock");
+ }
+
+ return mock.create(object);
+ }
+
+ function each(collection, callback) {
+ if (!collection) {
+ return;
+ }
+
+ for (var i = 0, l = collection.length; i < l; i += 1) {
+ callback(collection[i]);
+ }
+ }
+
+ sinon.extend(mock, {
+ create: function create(object) {
+ if (!object) {
+ throw new TypeError("object is null");
+ }
+
+ var mockObject = sinon.extend({}, mock);
+ mockObject.object = object;
+ delete mockObject.create;
+
+ return mockObject;
+ },
+
+ expects: function expects(method) {
+ if (!method) {
+ throw new TypeError("method is falsy");
+ }
+
+ if (!this.expectations) {
+ this.expectations = {};
+ this.proxies = [];
+ }
+
+ if (!this.expectations[method]) {
+ this.expectations[method] = [];
+ var mockObject = this;
+
+ sinon.wrapMethod(this.object, method, function () {
+ return mockObject.invokeMethod(method, this, arguments);
+ });
+
+ push.call(this.proxies, method);
+ }
+
+ var expectation = sinon.expectation.create(method);
+ push.call(this.expectations[method], expectation);
+
+ return expectation;
+ },
+
+ restore: function restore() {
+ var object = this.object;
+
+ each(this.proxies, function (proxy) {
+ if (typeof object[proxy].restore == "function") {
+ object[proxy].restore();
+ }
+ });
+ },
+
+ verify: function verify() {
+ var expectations = this.expectations || {};
+ var messages = [], met = [];
+
+ each(this.proxies, function (proxy) {
+ each(expectations[proxy], function (expectation) {
+ if (!expectation.met()) {
+ push.call(messages, expectation.toString());
+ } else {
+ push.call(met, expectation.toString());
+ }
+ });
+ });
+
+ this.restore();
+
+ if (messages.length > 0) {
+ sinon.expectation.fail(messages.concat(met).join("\n"));
+ } else if (met.length > 0) {
+ sinon.expectation.pass(messages.concat(met).join("\n"));
+ }
+
+ return true;
+ },
+
+ invokeMethod: function invokeMethod(method, thisValue, args) {
+ var expectations = this.expectations && this.expectations[method];
+ var length = expectations && expectations.length || 0, i;
+
+ for (i = 0; i < length; i += 1) {
+ if (!expectations[i].met() &&
+ expectations[i].allowsCall(thisValue, args)) {
+ return expectations[i].apply(thisValue, args);
+ }
+ }
+
+ var messages = [], available, exhausted = 0;
+
+ for (i = 0; i < length; i += 1) {
+ if (expectations[i].allowsCall(thisValue, args)) {
+ available = available || expectations[i];
+ } else {
+ exhausted += 1;
+ }
+ push.call(messages, " " + expectations[i].toString());
+ }
+
+ if (exhausted === 0) {
+ return available.apply(thisValue, args);
+ }
+
+ messages.unshift("Unexpected call: " + sinon.spyCall.toString.call({
+ proxy: method,
+ args: args
+ }));
+
+ sinon.expectation.fail(messages.join("\n"));
+ }
+ });
+
+ var times = sinon.timesInWords;
+ var slice = Array.prototype.slice;
+
+ function callCountInWords(callCount) {
+ if (callCount == 0) {
+ return "never called";
+ } else {
+ return "called " + times(callCount);
+ }
+ }
+
+ function expectedCallCountInWords(expectation) {
+ var min = expectation.minCalls;
+ var max = expectation.maxCalls;
+
+ if (typeof min == "number" && typeof max == "number") {
+ var str = times(min);
+
+ if (min != max) {
+ str = "at least " + str + " and at most " + times(max);
+ }
+
+ return str;
+ }
+
+ if (typeof min == "number") {
+ return "at least " + times(min);
+ }
+
+ return "at most " + times(max);
+ }
+
+ function receivedMinCalls(expectation) {
+ var hasMinLimit = typeof expectation.minCalls == "number";
+ return !hasMinLimit || expectation.callCount >= expectation.minCalls;
+ }
+
+ function receivedMaxCalls(expectation) {
+ if (typeof expectation.maxCalls != "number") {
+ return false;
+ }
+
+ return expectation.callCount == expectation.maxCalls;
+ }
+
+ function verifyMatcher(possibleMatcher, arg) {
+ if (match && match.isMatcher(possibleMatcher)) {
+ return possibleMatcher.test(arg);
+ } else {
+ return true;
+ }
+ }
+
+ sinon.expectation = {
+ minCalls: 1,
+ maxCalls: 1,
+
+ create: function create(methodName) {
+ var expectation = sinon.extend(sinon.stub.create(), sinon.expectation);
+ delete expectation.create;
+ expectation.method = methodName;
+
+ return expectation;
+ },
+
+ invoke: function invoke(func, thisValue, args) {
+ this.verifyCallAllowed(thisValue, args);
+
+ return sinon.spy.invoke.apply(this, arguments);
+ },
+
+ atLeast: function atLeast(num) {
+ if (typeof num != "number") {
+ throw new TypeError("'" + num + "' is not number");
+ }
+
+ if (!this.limitsSet) {
+ this.maxCalls = null;
+ this.limitsSet = true;
+ }
+
+ this.minCalls = num;
+
+ return this;
+ },
+
+ atMost: function atMost(num) {
+ if (typeof num != "number") {
+ throw new TypeError("'" + num + "' is not number");
+ }
+
+ if (!this.limitsSet) {
+ this.minCalls = null;
+ this.limitsSet = true;
+ }
+
+ this.maxCalls = num;
+
+ return this;
+ },
+
+ never: function never() {
+ return this.exactly(0);
+ },
+
+ once: function once() {
+ return this.exactly(1);
+ },
+
+ twice: function twice() {
+ return this.exactly(2);
+ },
+
+ thrice: function thrice() {
+ return this.exactly(3);
+ },
+
+ exactly: function exactly(num) {
+ if (typeof num != "number") {
+ throw new TypeError("'" + num + "' is not a number");
+ }
+
+ this.atLeast(num);
+ return this.atMost(num);
+ },
+
+ met: function met() {
+ return !this.failed && receivedMinCalls(this);
+ },
+
+ verifyCallAllowed: function verifyCallAllowed(thisValue, args) {
+ if (receivedMaxCalls(this)) {
+ this.failed = true;
+ sinon.expectation.fail(this.method + " already called " + times(this.maxCalls));
+ }
+
+ if ("expectedThis" in this && this.expectedThis !== thisValue) {
+ sinon.expectation.fail(this.method + " called with " + thisValue + " as thisValue, expected " +
+ this.expectedThis);
+ }
+
+ if (!("expectedArguments" in this)) {
+ return;
+ }
+
+ if (!args) {
+ sinon.expectation.fail(this.method + " received no arguments, expected " +
+ sinon.format(this.expectedArguments));
+ }
+
+ if (args.length < this.expectedArguments.length) {
+ sinon.expectation.fail(this.method + " received too few arguments (" + sinon.format(args) +
+ "), expected " + sinon.format(this.expectedArguments));
+ }
+
+ if (this.expectsExactArgCount &&
+ args.length != this.expectedArguments.length) {
+ sinon.expectation.fail(this.method + " received too many arguments (" + sinon.format(args) +
+ "), expected " + sinon.format(this.expectedArguments));
+ }
+
+ for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) {
+
+ if (!verifyMatcher(this.expectedArguments[i], args[i])) {
+ sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) +
+ ", didn't match " + this.expectedArguments.toString());
+ }
+
+ if (!sinon.deepEqual(this.expectedArguments[i], args[i])) {
+ sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) +
+ ", expected " + sinon.format(this.expectedArguments));
+ }
+ }
+ },
+
+ allowsCall: function allowsCall(thisValue, args) {
+ if (this.met() && receivedMaxCalls(this)) {
+ return false;
+ }
+
+ if ("expectedThis" in this && this.expectedThis !== thisValue) {
+ return false;
+ }
+
+ if (!("expectedArguments" in this)) {
+ return true;
+ }
+
+ args = args || [];
+
+ if (args.length < this.expectedArguments.length) {
+ return false;
+ }
+
+ if (this.expectsExactArgCount &&
+ args.length != this.expectedArguments.length) {
+ return false;
+ }
+
+ for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) {
+ if (!verifyMatcher(this.expectedArguments[i], args[i])) {
+ return false;
+ }
+
+ if (!sinon.deepEqual(this.expectedArguments[i], args[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ },
+
+ withArgs: function withArgs() {
+ this.expectedArguments = slice.call(arguments);
+ return this;
+ },
+
+ withExactArgs: function withExactArgs() {
+ this.withArgs.apply(this, arguments);
+ this.expectsExactArgCount = true;
+ return this;
+ },
+
+ on: function on(thisValue) {
+ this.expectedThis = thisValue;
+ return this;
+ },
+
+ toString: function () {
+ var args = (this.expectedArguments || []).slice();
+
+ if (!this.expectsExactArgCount) {
+ push.call(args, "[...]");
+ }
+
+ var callStr = sinon.spyCall.toString.call({
+ proxy: this.method || "anonymous mock expectation",
+ args: args
+ });
+
+ var message = callStr.replace(", [...", "[, ...") + " " +
+ expectedCallCountInWords(this);
+
+ if (this.met()) {
+ return "Expectation met: " + message;
+ }
+
+ return "Expected " + message + " (" +
+ callCountInWords(this.callCount) + ")";
+ },
+
+ verify: function verify() {
+ if (!this.met()) {
+ sinon.expectation.fail(this.toString());
+ } else {
+ sinon.expectation.pass(this.toString());
+ }
+
+ return true;
+ },
+
+ pass: function pass(message) {
+ sinon.assert.pass(message);
+ },
+
+ fail: function fail(message) {
+ var exception = new Error(message);
+ exception.name = "ExpectationError";
+
+ throw exception;
+ }
+ };
+
+ sinon.mock = mock;
+ return mock;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./times_in_words");
+ require("./call");
+ require("./extend");
+ require("./match");
+ require("./spy");
+ require("./stub");
+ require("./format");
+
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend util/core.js
+ * @depend spy.js
+ * @depend stub.js
+ * @depend mock.js
+ */
+/**
+ * Collections of stubs, spies and mocks.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+ var push = [].push;
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+ function getFakes(fakeCollection) {
+ if (!fakeCollection.fakes) {
+ fakeCollection.fakes = [];
+ }
+
+ return fakeCollection.fakes;
+ }
+
+ function each(fakeCollection, method) {
+ var fakes = getFakes(fakeCollection);
+
+ for (var i = 0, l = fakes.length; i < l; i += 1) {
+ if (typeof fakes[i][method] == "function") {
+ fakes[i][method]();
+ }
+ }
+ }
+
+ function compact(fakeCollection) {
+ var fakes = getFakes(fakeCollection);
+ var i = 0;
+ while (i < fakes.length) {
+ fakes.splice(i, 1);
+ }
+ }
+
+ function makeApi(sinon) {
+ var collection = {
+ verify: function resolve() {
+ each(this, "verify");
+ },
+
+ restore: function restore() {
+ each(this, "restore");
+ compact(this);
+ },
+
+ reset: function restore() {
+ each(this, "reset");
+ },
+
+ verifyAndRestore: function verifyAndRestore() {
+ var exception;
+
+ try {
+ this.verify();
+ } catch (e) {
+ exception = e;
+ }
+
+ this.restore();
+
+ if (exception) {
+ throw exception;
+ }
+ },
+
+ add: function add(fake) {
+ push.call(getFakes(this), fake);
+ return fake;
+ },
+
+ spy: function spy() {
+ return this.add(sinon.spy.apply(sinon, arguments));
+ },
+
+ stub: function stub(object, property, value) {
+ if (property) {
+ var original = object[property];
+
+ if (typeof original != "function") {
+ if (!hasOwnProperty.call(object, property)) {
+ throw new TypeError("Cannot stub non-existent own property " + property);
+ }
+
+ object[property] = value;
+
+ return this.add({
+ restore: function () {
+ object[property] = original;
+ }
+ });
+ }
+ }
+ if (!property && !!object && typeof object == "object") {
+ var stubbedObj = sinon.stub.apply(sinon, arguments);
+
+ for (var prop in stubbedObj) {
+ if (typeof stubbedObj[prop] === "function") {
+ this.add(stubbedObj[prop]);
+ }
+ }
+
+ return stubbedObj;
+ }
+
+ return this.add(sinon.stub.apply(sinon, arguments));
+ },
+
+ mock: function mock() {
+ return this.add(sinon.mock.apply(sinon, arguments));
+ },
+
+ inject: function inject(obj) {
+ var col = this;
+
+ obj.spy = function () {
+ return col.spy.apply(col, arguments);
+ };
+
+ obj.stub = function () {
+ return col.stub.apply(col, arguments);
+ };
+
+ obj.mock = function () {
+ return col.mock.apply(col, arguments);
+ };
+
+ return obj;
+ }
+ };
+
+ sinon.collection = collection;
+ return collection;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./mock");
+ require("./spy");
+ require("./stub");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/*global lolex */
+
+/**
+ * Fake timer API
+ * setTimeout
+ * setInterval
+ * clearTimeout
+ * clearInterval
+ * tick
+ * reset
+ * Date
+ *
+ * Inspired by jsUnitMockTimeOut from JsUnit
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+if (typeof sinon == "undefined") {
+ var sinon = {};
+}
+
+(function (global) {
+ function makeApi(sinon, lol) {
+ var llx = typeof lolex !== "undefined" ? lolex : lol;
+
+ sinon.useFakeTimers = function () {
+ var now, methods = Array.prototype.slice.call(arguments);
+
+ if (typeof methods[0] === "string") {
+ now = 0;
+ } else {
+ now = methods.shift();
+ }
+
+ var clock = llx.install(now || 0, methods);
+ clock.restore = clock.uninstall;
+ return clock;
+ };
+
+ sinon.clock = {
+ create: function (now) {
+ return llx.createClock(now);
+ }
+ };
+
+ sinon.timers = {
+ setTimeout: setTimeout,
+ clearTimeout: clearTimeout,
+ setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined),
+ clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate : undefined),
+ setInterval: setInterval,
+ clearInterval: clearInterval,
+ Date: Date
+ };
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, epxorts, module, lolex) {
+ var sinon = require("./core");
+ makeApi(sinon, lolex);
+ module.exports = sinon;
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module, require("lolex"));
+ } else {
+ makeApi(sinon);
+ }
+}(typeof global != "undefined" && typeof global !== "function" ? global : this));
+
+/**
+ * Minimal Event interface implementation
+ *
+ * Original implementation by Sven Fuchs: https://gist.github.com/995028
+ * Modifications and tests by Christian Johansen.
+ *
+ * @author Sven Fuchs (svenfuchs@artweb-design.de)
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2011 Sven Fuchs, Christian Johansen
+ */
+
+if (typeof sinon == "undefined") {
+ this.sinon = {};
+}
+
+(function () {
+ var push = [].push;
+
+ function makeApi(sinon) {
+ sinon.Event = function Event(type, bubbles, cancelable, target) {
+ this.initEvent(type, bubbles, cancelable, target);
+ };
+
+ sinon.Event.prototype = {
+ initEvent: function (type, bubbles, cancelable, target) {
+ this.type = type;
+ this.bubbles = bubbles;
+ this.cancelable = cancelable;
+ this.target = target;
+ },
+
+ stopPropagation: function () {},
+
+ preventDefault: function () {
+ this.defaultPrevented = true;
+ }
+ };
+
+ sinon.ProgressEvent = function ProgressEvent(type, progressEventRaw, target) {
+ this.initEvent(type, false, false, target);
+ this.loaded = progressEventRaw.loaded || null;
+ this.total = progressEventRaw.total || null;
+ this.lengthComputable = !!progressEventRaw.total;
+ };
+
+ sinon.ProgressEvent.prototype = new sinon.Event();
+
+ sinon.ProgressEvent.prototype.constructor = sinon.ProgressEvent;
+
+ sinon.CustomEvent = function CustomEvent(type, customData, target) {
+ this.initEvent(type, false, false, target);
+ this.detail = customData.detail || null;
+ };
+
+ sinon.CustomEvent.prototype = new sinon.Event();
+
+ sinon.CustomEvent.prototype.constructor = sinon.CustomEvent;
+
+ sinon.EventTarget = {
+ addEventListener: function addEventListener(event, listener) {
+ this.eventListeners = this.eventListeners || {};
+ this.eventListeners[event] = this.eventListeners[event] || [];
+ push.call(this.eventListeners[event], listener);
+ },
+
+ removeEventListener: function removeEventListener(event, listener) {
+ var listeners = this.eventListeners && this.eventListeners[event] || [];
+
+ for (var i = 0, l = listeners.length; i < l; ++i) {
+ if (listeners[i] == listener) {
+ return listeners.splice(i, 1);
+ }
+ }
+ },
+
+ dispatchEvent: function dispatchEvent(event) {
+ var type = event.type;
+ var listeners = this.eventListeners && this.eventListeners[type] || [];
+
+ for (var i = 0; i < listeners.length; i++) {
+ if (typeof listeners[i] == "function") {
+ listeners[i].call(this, event);
+ } else {
+ listeners[i].handleEvent(event);
+ }
+ }
+
+ return !!event.defaultPrevented;
+ }
+ };
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require) {
+ var sinon = require("./core");
+ makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require);
+ } else {
+ makeApi(sinon);
+ }
+}());
+
+/**
+ * @depend util/core.js
+ */
+/**
+ * Logs errors
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2014 Christian Johansen
+ */
+
+(function (sinon) {
+ // cache a reference to setTimeout, so that our reference won't be stubbed out
+ // when using fake timers and errors will still get logged
+ // https://github.com/cjohansen/Sinon.JS/issues/381
+ var realSetTimeout = setTimeout;
+
+ function makeApi(sinon) {
+
+ function log() {}
+
+ function logError(label, err) {
+ var msg = label + " threw exception: ";
+
+ sinon.log(msg + "[" + err.name + "] " + err.message);
+
+ if (err.stack) {
+ sinon.log(err.stack);
+ }
+
+ logError.setTimeout(function () {
+ err.message = msg + err.message;
+ throw err;
+ }, 0);
+ };
+
+ // wrap realSetTimeout with something we can stub in tests
+ logError.setTimeout = function (func, timeout) {
+ realSetTimeout(func, timeout);
+ }
+
+ var exports = {};
+ exports.log = sinon.log = log;
+ exports.logError = sinon.logError = logError;
+
+ return exports;
+ }
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ module.exports = makeApi(sinon);
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend core.js
+ * @depend ../extend.js
+ * @depend event.js
+ * @depend ../log_error.js
+ */
+/**
+ * Fake XDomainRequest object
+ */
+
+if (typeof sinon == "undefined") {
+ this.sinon = {};
+}
+
+// wrapper for global
+(function (global) {
+ var xdr = { XDomainRequest: global.XDomainRequest };
+ xdr.GlobalXDomainRequest = global.XDomainRequest;
+ xdr.supportsXDR = typeof xdr.GlobalXDomainRequest != "undefined";
+ xdr.workingXDR = xdr.supportsXDR ? xdr.GlobalXDomainRequest : false;
+
+ function makeApi(sinon) {
+ sinon.xdr = xdr;
+
+ function FakeXDomainRequest() {
+ this.readyState = FakeXDomainRequest.UNSENT;
+ this.requestBody = null;
+ this.requestHeaders = {};
+ this.status = 0;
+ this.timeout = null;
+
+ if (typeof FakeXDomainRequest.onCreate == "function") {
+ FakeXDomainRequest.onCreate(this);
+ }
+ }
+
+ function verifyState(xdr) {
+ if (xdr.readyState !== FakeXDomainRequest.OPENED) {
+ throw new Error("INVALID_STATE_ERR");
+ }
+
+ if (xdr.sendFlag) {
+ throw new Error("INVALID_STATE_ERR");
+ }
+ }
+
+ function verifyRequestSent(xdr) {
+ if (xdr.readyState == FakeXDomainRequest.UNSENT) {
+ throw new Error("Request not sent");
+ }
+ if (xdr.readyState == FakeXDomainRequest.DONE) {
+ throw new Error("Request done");
+ }
+ }
+
+ function verifyResponseBodyType(body) {
+ if (typeof body != "string") {
+ var error = new Error("Attempted to respond to fake XDomainRequest with " +
+ body + ", which is not a string.");
+ error.name = "InvalidBodyException";
+ throw error;
+ }
+ }
+
+ sinon.extend(FakeXDomainRequest.prototype, sinon.EventTarget, {
+ open: function open(method, url) {
+ this.method = method;
+ this.url = url;
+
+ this.responseText = null;
+ this.sendFlag = false;
+
+ this.readyStateChange(FakeXDomainRequest.OPENED);
+ },
+
+ readyStateChange: function readyStateChange(state) {
+ this.readyState = state;
+ var eventName = "";
+ switch (this.readyState) {
+ case FakeXDomainRequest.UNSENT:
+ break;
+ case FakeXDomainRequest.OPENED:
+ break;
+ case FakeXDomainRequest.LOADING:
+ if (this.sendFlag) {
+ //raise the progress event
+ eventName = "onprogress";
+ }
+ break;
+ case FakeXDomainRequest.DONE:
+ if (this.isTimeout) {
+ eventName = "ontimeout"
+ } else if (this.errorFlag || (this.status < 200 || this.status > 299)) {
+ eventName = "onerror";
+ } else {
+ eventName = "onload"
+ }
+ break;
+ }
+
+ // raising event (if defined)
+ if (eventName) {
+ if (typeof this[eventName] == "function") {
+ try {
+ this[eventName]();
+ } catch (e) {
+ sinon.logError("Fake XHR " + eventName + " handler", e);
+ }
+ }
+ }
+ },
+
+ send: function send(data) {
+ verifyState(this);
+
+ if (!/^(get|head)$/i.test(this.method)) {
+ this.requestBody = data;
+ }
+ this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8";
+
+ this.errorFlag = false;
+ this.sendFlag = true;
+ this.readyStateChange(FakeXDomainRequest.OPENED);
+
+ if (typeof this.onSend == "function") {
+ this.onSend(this);
+ }
+ },
+
+ abort: function abort() {
+ this.aborted = true;
+ this.responseText = null;
+ this.errorFlag = true;
+
+ if (this.readyState > sinon.FakeXDomainRequest.UNSENT && this.sendFlag) {
+ this.readyStateChange(sinon.FakeXDomainRequest.DONE);
+ this.sendFlag = false;
+ }
+ },
+
+ setResponseBody: function setResponseBody(body) {
+ verifyRequestSent(this);
+ verifyResponseBodyType(body);
+
+ var chunkSize = this.chunkSize || 10;
+ var index = 0;
+ this.responseText = "";
+
+ do {
+ this.readyStateChange(FakeXDomainRequest.LOADING);
+ this.responseText += body.substring(index, index + chunkSize);
+ index += chunkSize;
+ } while (index < body.length);
+
+ this.readyStateChange(FakeXDomainRequest.DONE);
+ },
+
+ respond: function respond(status, contentType, body) {
+ // content-type ignored, since XDomainRequest does not carry this
+ // we keep the same syntax for respond(...) as for FakeXMLHttpRequest to ease
+ // test integration across browsers
+ this.status = typeof status == "number" ? status : 200;
+ this.setResponseBody(body || "");
+ },
+
+ simulatetimeout: function simulatetimeout() {
+ this.status = 0;
+ this.isTimeout = true;
+ // Access to this should actually throw an error
+ this.responseText = undefined;
+ this.readyStateChange(FakeXDomainRequest.DONE);
+ }
+ });
+
+ sinon.extend(FakeXDomainRequest, {
+ UNSENT: 0,
+ OPENED: 1,
+ LOADING: 3,
+ DONE: 4
+ });
+
+ sinon.useFakeXDomainRequest = function useFakeXDomainRequest() {
+ sinon.FakeXDomainRequest.restore = function restore(keepOnCreate) {
+ if (xdr.supportsXDR) {
+ global.XDomainRequest = xdr.GlobalXDomainRequest;
+ }
+
+ delete sinon.FakeXDomainRequest.restore;
+
+ if (keepOnCreate !== true) {
+ delete sinon.FakeXDomainRequest.onCreate;
+ }
+ };
+ if (xdr.supportsXDR) {
+ global.XDomainRequest = sinon.FakeXDomainRequest;
+ }
+ return sinon.FakeXDomainRequest;
+ };
+
+ sinon.FakeXDomainRequest = FakeXDomainRequest;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./core");
+ require("../extend");
+ require("./event");
+ require("../log_error");
+ makeApi(sinon);
+ module.exports = sinon;
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else {
+ makeApi(sinon);
+ }
+})(typeof global !== "undefined" ? global : self);
+
+/**
+ * @depend core.js
+ * @depend ../extend.js
+ * @depend event.js
+ * @depend ../log_error.js
+ */
+/**
+ * Fake XMLHttpRequest object
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (global) {
+
+ var supportsProgress = typeof ProgressEvent !== "undefined";
+ var supportsCustomEvent = typeof CustomEvent !== "undefined";
+ var supportsFormData = typeof FormData !== "undefined";
+ var sinonXhr = { XMLHttpRequest: global.XMLHttpRequest };
+ sinonXhr.GlobalXMLHttpRequest = global.XMLHttpRequest;
+ sinonXhr.GlobalActiveXObject = global.ActiveXObject;
+ sinonXhr.supportsActiveX = typeof sinonXhr.GlobalActiveXObject != "undefined";
+ sinonXhr.supportsXHR = typeof sinonXhr.GlobalXMLHttpRequest != "undefined";
+ sinonXhr.workingXHR = sinonXhr.supportsXHR ? sinonXhr.GlobalXMLHttpRequest : sinonXhr.supportsActiveX
+ ? function () {
+ return new sinonXhr.GlobalActiveXObject("MSXML2.XMLHTTP.3.0")
+ } : false;
+ sinonXhr.supportsCORS = sinonXhr.supportsXHR && "withCredentials" in (new sinonXhr.GlobalXMLHttpRequest());
+
+ /*jsl:ignore*/
+ var unsafeHeaders = {
+ "Accept-Charset": true,
+ "Accept-Encoding": true,
+ Connection: true,
+ "Content-Length": true,
+ Cookie: true,
+ Cookie2: true,
+ "Content-Transfer-Encoding": true,
+ Date: true,
+ Expect: true,
+ Host: true,
+ "Keep-Alive": true,
+ Referer: true,
+ TE: true,
+ Trailer: true,
+ "Transfer-Encoding": true,
+ Upgrade: true,
+ "User-Agent": true,
+ Via: true
+ };
+ /*jsl:end*/
+
+ // Note that for FakeXMLHttpRequest to work pre ES5
+ // we lose some of the alignment with the spec.
+ // To ensure as close a match as possible,
+ // set responseType before calling open, send or respond;
+ function FakeXMLHttpRequest() {
+ this.readyState = FakeXMLHttpRequest.UNSENT;
+ this.requestHeaders = {};
+ this.requestBody = null;
+ this.status = 0;
+ this.statusText = "";
+ this.upload = new UploadProgress();
+ this.responseType = "";
+ this.response = "";
+ if (sinonXhr.supportsCORS) {
+ this.withCredentials = false;
+ }
+
+ var xhr = this;
+ var events = ["loadstart", "load", "abort", "loadend"];
+
+ function addEventListener(eventName) {
+ xhr.addEventListener(eventName, function (event) {
+ var listener = xhr["on" + eventName];
+
+ if (listener && typeof listener == "function") {
+ listener.call(this, event);
+ }
+ });
+ }
+
+ for (var i = events.length - 1; i >= 0; i--) {
+ addEventListener(events[i]);
+ }
+
+ if (typeof FakeXMLHttpRequest.onCreate == "function") {
+ FakeXMLHttpRequest.onCreate(this);
+ }
+ }
+
+ // An upload object is created for each
+ // FakeXMLHttpRequest and allows upload
+ // events to be simulated using uploadProgress
+ // and uploadError.
+ function UploadProgress() {
+ this.eventListeners = {
+ progress: [],
+ load: [],
+ abort: [],
+ error: []
+ }
+ }
+
+ UploadProgress.prototype.addEventListener = function addEventListener(event, listener) {
+ this.eventListeners[event].push(listener);
+ };
+
+ UploadProgress.prototype.removeEventListener = function removeEventListener(event, listener) {
+ var listeners = this.eventListeners[event] || [];
+
+ for (var i = 0, l = listeners.length; i < l; ++i) {
+ if (listeners[i] == listener) {
+ return listeners.splice(i, 1);
+ }
+ }
+ };
+
+ UploadProgress.prototype.dispatchEvent = function dispatchEvent(event) {
+ var listeners = this.eventListeners[event.type] || [];
+
+ for (var i = 0, listener; (listener = listeners[i]) != null; i++) {
+ listener(event);
+ }
+ };
+
+ function verifyState(xhr) {
+ if (xhr.readyState !== FakeXMLHttpRequest.OPENED) {
+ throw new Error("INVALID_STATE_ERR");
+ }
+
+ if (xhr.sendFlag) {
+ throw new Error("INVALID_STATE_ERR");
+ }
+ }
+
+ function getHeader(headers, header) {
+ header = header.toLowerCase();
+
+ for (var h in headers) {
+ if (h.toLowerCase() == header) {
+ return h;
+ }
+ }
+
+ return null;
+ }
+
+ // filtering to enable a white-list version of Sinon FakeXhr,
+ // where whitelisted requests are passed through to real XHR
+ function each(collection, callback) {
+ if (!collection) {
+ return;
+ }
+
+ for (var i = 0, l = collection.length; i < l; i += 1) {
+ callback(collection[i]);
+ }
+ }
+ function some(collection, callback) {
+ for (var index = 0; index < collection.length; index++) {
+ if (callback(collection[index]) === true) {
+ return true;
+ }
+ }
+ return false;
+ }
+ // largest arity in XHR is 5 - XHR#open
+ var apply = function (obj, method, args) {
+ switch (args.length) {
+ case 0: return obj[method]();
+ case 1: return obj[method](args[0]);
+ case 2: return obj[method](args[0], args[1]);
+ case 3: return obj[method](args[0], args[1], args[2]);
+ case 4: return obj[method](args[0], args[1], args[2], args[3]);
+ case 5: return obj[method](args[0], args[1], args[2], args[3], args[4]);
+ }
+ };
+
+ FakeXMLHttpRequest.filters = [];
+ FakeXMLHttpRequest.addFilter = function addFilter(fn) {
+ this.filters.push(fn)
+ };
+ var IE6Re = /MSIE 6/;
+ FakeXMLHttpRequest.defake = function defake(fakeXhr, xhrArgs) {
+ var xhr = new sinonXhr.workingXHR();
+ each([
+ "open",
+ "setRequestHeader",
+ "send",
+ "abort",
+ "getResponseHeader",
+ "getAllResponseHeaders",
+ "addEventListener",
+ "overrideMimeType",
+ "removeEventListener"
+ ], function (method) {
+ fakeXhr[method] = function () {
+ return apply(xhr, method, arguments);
+ };
+ });
+
+ var copyAttrs = function (args) {
+ each(args, function (attr) {
+ try {
+ fakeXhr[attr] = xhr[attr]
+ } catch (e) {
+ if (!IE6Re.test(navigator.userAgent)) {
+ throw e;
+ }
+ }
+ });
+ };
+
+ var stateChange = function stateChange() {
+ fakeXhr.readyState = xhr.readyState;
+ if (xhr.readyState >= FakeXMLHttpRequest.HEADERS_RECEIVED) {
+ copyAttrs(["status", "statusText"]);
+ }
+ if (xhr.readyState >= FakeXMLHttpRequest.LOADING) {
+ copyAttrs(["responseText", "response"]);
+ }
+ if (xhr.readyState === FakeXMLHttpRequest.DONE) {
+ copyAttrs(["responseXML"]);
+ }
+ if (fakeXhr.onreadystatechange) {
+ fakeXhr.onreadystatechange.call(fakeXhr, { target: fakeXhr });
+ }
+ };
+
+ if (xhr.addEventListener) {
+ for (var event in fakeXhr.eventListeners) {
+ if (fakeXhr.eventListeners.hasOwnProperty(event)) {
+ each(fakeXhr.eventListeners[event], function (handler) {
+ xhr.addEventListener(event, handler);
+ });
+ }
+ }
+ xhr.addEventListener("readystatechange", stateChange);
+ } else {
+ xhr.onreadystatechange = stateChange;
+ }
+ apply(xhr, "open", xhrArgs);
+ };
+ FakeXMLHttpRequest.useFilters = false;
+
+ function verifyRequestOpened(xhr) {
+ if (xhr.readyState != FakeXMLHttpRequest.OPENED) {
+ throw new Error("INVALID_STATE_ERR - " + xhr.readyState);
+ }
+ }
+
+ function verifyRequestSent(xhr) {
+ if (xhr.readyState == FakeXMLHttpRequest.DONE) {
+ throw new Error("Request done");
+ }
+ }
+
+ function verifyHeadersReceived(xhr) {
+ if (xhr.async && xhr.readyState != FakeXMLHttpRequest.HEADERS_RECEIVED) {
+ throw new Error("No headers received");
+ }
+ }
+
+ function verifyResponseBodyType(body) {
+ if (typeof body != "string") {
+ var error = new Error("Attempted to respond to fake XMLHttpRequest with " +
+ body + ", which is not a string.");
+ error.name = "InvalidBodyException";
+ throw error;
+ }
+ }
+
+ FakeXMLHttpRequest.parseXML = function parseXML(text) {
+ var xmlDoc;
+
+ if (typeof DOMParser != "undefined") {
+ var parser = new DOMParser();
+ xmlDoc = parser.parseFromString(text, "text/xml");
+ } else {
+ xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
+ xmlDoc.async = "false";
+ xmlDoc.loadXML(text);
+ }
+
+ return xmlDoc;
+ };
+
+ FakeXMLHttpRequest.statusCodes = {
+ 100: "Continue",
+ 101: "Switching Protocols",
+ 200: "OK",
+ 201: "Created",
+ 202: "Accepted",
+ 203: "Non-Authoritative Information",
+ 204: "No Content",
+ 205: "Reset Content",
+ 206: "Partial Content",
+ 207: "Multi-Status",
+ 300: "Multiple Choice",
+ 301: "Moved Permanently",
+ 302: "Found",
+ 303: "See Other",
+ 304: "Not Modified",
+ 305: "Use Proxy",
+ 307: "Temporary Redirect",
+ 400: "Bad Request",
+ 401: "Unauthorized",
+ 402: "Payment Required",
+ 403: "Forbidden",
+ 404: "Not Found",
+ 405: "Method Not Allowed",
+ 406: "Not Acceptable",
+ 407: "Proxy Authentication Required",
+ 408: "Request Timeout",
+ 409: "Conflict",
+ 410: "Gone",
+ 411: "Length Required",
+ 412: "Precondition Failed",
+ 413: "Request Entity Too Large",
+ 414: "Request-URI Too Long",
+ 415: "Unsupported Media Type",
+ 416: "Requested Range Not Satisfiable",
+ 417: "Expectation Failed",
+ 422: "Unprocessable Entity",
+ 500: "Internal Server Error",
+ 501: "Not Implemented",
+ 502: "Bad Gateway",
+ 503: "Service Unavailable",
+ 504: "Gateway Timeout",
+ 505: "HTTP Version Not Supported"
+ };
+
+ function makeApi(sinon) {
+ sinon.xhr = sinonXhr;
+
+ sinon.extend(FakeXMLHttpRequest.prototype, sinon.EventTarget, {
+ async: true,
+
+ open: function open(method, url, async, username, password) {
+ this.method = method;
+ this.url = url;
+ this.async = typeof async == "boolean" ? async : true;
+ this.username = username;
+ this.password = password;
+ this.responseText = null;
+ this.response = this.responseType === "json" ? null : "";
+ this.responseXML = null;
+ this.requestHeaders = {};
+ this.sendFlag = false;
+
+ if (FakeXMLHttpRequest.useFilters === true) {
+ var xhrArgs = arguments;
+ var defake = some(FakeXMLHttpRequest.filters, function (filter) {
+ return filter.apply(this, xhrArgs)
+ });
+ if (defake) {
+ return FakeXMLHttpRequest.defake(this, arguments);
+ }
+ }
+ this.readyStateChange(FakeXMLHttpRequest.OPENED);
+ },
+
+ readyStateChange: function readyStateChange(state) {
+ this.readyState = state;
+
+ if (typeof this.onreadystatechange == "function") {
+ try {
+ this.onreadystatechange();
+ } catch (e) {
+ sinon.logError("Fake XHR onreadystatechange handler", e);
+ }
+ }
+
+ switch (this.readyState) {
+ case FakeXMLHttpRequest.DONE:
+ if (supportsProgress) {
+ this.upload.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100}));
+ this.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100}));
+ }
+ this.upload.dispatchEvent(new sinon.Event("load", false, false, this));
+ this.dispatchEvent(new sinon.Event("load", false, false, this));
+ this.dispatchEvent(new sinon.Event("loadend", false, false, this));
+ break;
+ }
+
+ this.dispatchEvent(new sinon.Event("readystatechange"));
+ },
+
+ setRequestHeader: function setRequestHeader(header, value) {
+ verifyState(this);
+
+ if (unsafeHeaders[header] || /^(Sec-|Proxy-)/.test(header)) {
+ throw new Error("Refused to set unsafe header \"" + header + "\"");
+ }
+
+ if (this.requestHeaders[header]) {
+ this.requestHeaders[header] += "," + value;
+ } else {
+ this.requestHeaders[header] = value;
+ }
+ },
+
+ // Helps testing
+ setResponseHeaders: function setResponseHeaders(headers) {
+ verifyRequestOpened(this);
+ this.responseHeaders = {};
+
+ for (var header in headers) {
+ if (headers.hasOwnProperty(header)) {
+ this.responseHeaders[header] = headers[header];
+ }
+ }
+
+ if (this.async) {
+ this.readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED);
+ } else {
+ this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED;
+ }
+ },
+
+ // Currently treats ALL data as a DOMString (i.e. no Document)
+ send: function send(data) {
+ verifyState(this);
+
+ if (!/^(get|head)$/i.test(this.method)) {
+ var contentType = getHeader(this.requestHeaders, "Content-Type");
+ if (this.requestHeaders[contentType]) {
+ var value = this.requestHeaders[contentType].split(";");
+ this.requestHeaders[contentType] = value[0] + ";charset=utf-8";
+ } else if (supportsFormData && !(data instanceof FormData)) {
+ this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8";
+ }
+
+ this.requestBody = data;
+ }
+
+ this.errorFlag = false;
+ this.sendFlag = this.async;
+ this.response = this.responseType === "json" ? null : "";
+ this.readyStateChange(FakeXMLHttpRequest.OPENED);
+
+ if (typeof this.onSend == "function") {
+ this.onSend(this);
+ }
+
+ this.dispatchEvent(new sinon.Event("loadstart", false, false, this));
+ },
+
+ abort: function abort() {
+ this.aborted = true;
+ this.responseText = null;
+ this.response = this.responseType === "json" ? null : "";
+ this.errorFlag = true;
+ this.requestHeaders = {};
+ this.responseHeaders = {};
+
+ if (this.readyState > FakeXMLHttpRequest.UNSENT && this.sendFlag) {
+ this.readyStateChange(FakeXMLHttpRequest.DONE);
+ this.sendFlag = false;
+ }
+
+ this.readyState = FakeXMLHttpRequest.UNSENT;
+
+ this.dispatchEvent(new sinon.Event("abort", false, false, this));
+
+ this.upload.dispatchEvent(new sinon.Event("abort", false, false, this));
+
+ if (typeof this.onerror === "function") {
+ this.onerror();
+ }
+ },
+
+ getResponseHeader: function getResponseHeader(header) {
+ if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) {
+ return null;
+ }
+
+ if (/^Set-Cookie2?$/i.test(header)) {
+ return null;
+ }
+
+ header = getHeader(this.responseHeaders, header);
+
+ return this.responseHeaders[header] || null;
+ },
+
+ getAllResponseHeaders: function getAllResponseHeaders() {
+ if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) {
+ return "";
+ }
+
+ var headers = "";
+
+ for (var header in this.responseHeaders) {
+ if (this.responseHeaders.hasOwnProperty(header) &&
+ !/^Set-Cookie2?$/i.test(header)) {
+ headers += header + ": " + this.responseHeaders[header] + "\r\n";
+ }
+ }
+
+ return headers;
+ },
+
+ setResponseBody: function setResponseBody(body) {
+ verifyRequestSent(this);
+ verifyHeadersReceived(this);
+ verifyResponseBodyType(body);
+
+ var chunkSize = this.chunkSize || 10;
+ var index = 0;
+ this.responseText = "";
+
+ do {
+ if (this.async) {
+ this.readyStateChange(FakeXMLHttpRequest.LOADING);
+ }
+
+ this.responseText += body.substring(index, index + chunkSize);
+ index += chunkSize;
+ } while (index < body.length);
+
+ var type = this.getResponseHeader("Content-Type");
+
+ if (this.responseText &&
+ (!type || /(text\/xml)|(application\/xml)|(\+xml)/.test(type))) {
+ try {
+ this.responseXML = FakeXMLHttpRequest.parseXML(this.responseText);
+ } catch (e) {
+ // Unable to parse XML - no biggie
+ }
+ }
+
+ this.response = this.responseType === "json" ? JSON.parse(this.responseText) : this.responseText;
+ this.readyStateChange(FakeXMLHttpRequest.DONE);
+ },
+
+ respond: function respond(status, headers, body) {
+ this.status = typeof status == "number" ? status : 200;
+ this.statusText = FakeXMLHttpRequest.statusCodes[this.status];
+ this.setResponseHeaders(headers || {});
+ this.setResponseBody(body || "");
+ },
+
+ uploadProgress: function uploadProgress(progressEventRaw) {
+ if (supportsProgress) {
+ this.upload.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw));
+ }
+ },
+
+ downloadProgress: function downloadProgress(progressEventRaw) {
+ if (supportsProgress) {
+ this.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw));
+ }
+ },
+
+ uploadError: function uploadError(error) {
+ if (supportsCustomEvent) {
+ this.upload.dispatchEvent(new sinon.CustomEvent("error", {detail: error}));
+ }
+ }
+ });
+
+ sinon.extend(FakeXMLHttpRequest, {
+ UNSENT: 0,
+ OPENED: 1,
+ HEADERS_RECEIVED: 2,
+ LOADING: 3,
+ DONE: 4
+ });
+
+ sinon.useFakeXMLHttpRequest = function () {
+ FakeXMLHttpRequest.restore = function restore(keepOnCreate) {
+ if (sinonXhr.supportsXHR) {
+ global.XMLHttpRequest = sinonXhr.GlobalXMLHttpRequest;
+ }
+
+ if (sinonXhr.supportsActiveX) {
+ global.ActiveXObject = sinonXhr.GlobalActiveXObject;
+ }
+
+ delete FakeXMLHttpRequest.restore;
+
+ if (keepOnCreate !== true) {
+ delete FakeXMLHttpRequest.onCreate;
+ }
+ };
+ if (sinonXhr.supportsXHR) {
+ global.XMLHttpRequest = FakeXMLHttpRequest;
+ }
+
+ if (sinonXhr.supportsActiveX) {
+ global.ActiveXObject = function ActiveXObject(objId) {
+ if (objId == "Microsoft.XMLHTTP" || /^Msxml2\.XMLHTTP/i.test(objId)) {
+
+ return new FakeXMLHttpRequest();
+ }
+
+ return new sinonXhr.GlobalActiveXObject(objId);
+ };
+ }
+
+ return FakeXMLHttpRequest;
+ };
+
+ sinon.FakeXMLHttpRequest = FakeXMLHttpRequest;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./core");
+ require("../extend");
+ require("./event");
+ require("../log_error");
+ makeApi(sinon);
+ module.exports = sinon;
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (typeof sinon === "undefined") {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+
+})(typeof global !== "undefined" ? global : self);
+
+/**
+ * @depend fake_xdomain_request.js
+ * @depend fake_xml_http_request.js
+ * @depend ../format.js
+ * @depend ../log_error.js
+ */
+/**
+ * The Sinon "server" mimics a web server that receives requests from
+ * sinon.FakeXMLHttpRequest and provides an API to respond to those requests,
+ * both synchronously and asynchronously. To respond synchronuously, canned
+ * answers have to be provided upfront.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+if (typeof sinon == "undefined") {
+ var sinon = {};
+}
+
+(function () {
+ var push = [].push;
+ function F() {}
+
+ function create(proto) {
+ F.prototype = proto;
+ return new F();
+ }
+
+ function responseArray(handler) {
+ var response = handler;
+
+ if (Object.prototype.toString.call(handler) != "[object Array]") {
+ response = [200, {}, handler];
+ }
+
+ if (typeof response[2] != "string") {
+ throw new TypeError("Fake server response body should be string, but was " +
+ typeof response[2]);
+ }
+
+ return response;
+ }
+
+ var wloc = typeof window !== "undefined" ? window.location : {};
+ var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host);
+
+ function matchOne(response, reqMethod, reqUrl) {
+ var rmeth = response.method;
+ var matchMethod = !rmeth || rmeth.toLowerCase() == reqMethod.toLowerCase();
+ var url = response.url;
+ var matchUrl = !url || url == reqUrl || (typeof url.test == "function" && url.test(reqUrl));
+
+ return matchMethod && matchUrl;
+ }
+
+ function match(response, request) {
+ var requestUrl = request.url;
+
+ if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) {
+ requestUrl = requestUrl.replace(rCurrLoc, "");
+ }
+
+ if (matchOne(response, this.getHTTPMethod(request), requestUrl)) {
+ if (typeof response.response == "function") {
+ var ru = response.url;
+ var args = [request].concat(ru && typeof ru.exec == "function" ? ru.exec(requestUrl).slice(1) : []);
+ return response.response.apply(response, args);
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ function makeApi(sinon) {
+ sinon.fakeServer = {
+ create: function () {
+ var server = create(this);
+ if (!sinon.xhr.supportsCORS) {
+ this.xhr = sinon.useFakeXDomainRequest();
+ } else {
+ this.xhr = sinon.useFakeXMLHttpRequest();
+ }
+ server.requests = [];
+
+ this.xhr.onCreate = function (xhrObj) {
+ server.addRequest(xhrObj);
+ };
+
+ return server;
+ },
+
+ addRequest: function addRequest(xhrObj) {
+ var server = this;
+ push.call(this.requests, xhrObj);
+
+ xhrObj.onSend = function () {
+ server.handleRequest(this);
+
+ if (server.respondImmediately) {
+ server.respond();
+ } else if (server.autoRespond && !server.responding) {
+ setTimeout(function () {
+ server.responding = false;
+ server.respond();
+ }, server.autoRespondAfter || 10);
+
+ server.responding = true;
+ }
+ };
+ },
+
+ getHTTPMethod: function getHTTPMethod(request) {
+ if (this.fakeHTTPMethods && /post/i.test(request.method)) {
+ var matches = (request.requestBody || "").match(/_method=([^\b;]+)/);
+ return !!matches ? matches[1] : request.method;
+ }
+
+ return request.method;
+ },
+
+ handleRequest: function handleRequest(xhr) {
+ if (xhr.async) {
+ if (!this.queue) {
+ this.queue = [];
+ }
+
+ push.call(this.queue, xhr);
+ } else {
+ this.processRequest(xhr);
+ }
+ },
+
+ log: function log(response, request) {
+ var str;
+
+ str = "Request:\n" + sinon.format(request) + "\n\n";
+ str += "Response:\n" + sinon.format(response) + "\n\n";
+
+ sinon.log(str);
+ },
+
+ respondWith: function respondWith(method, url, body) {
+ if (arguments.length == 1 && typeof method != "function") {
+ this.response = responseArray(method);
+ return;
+ }
+
+ if (!this.responses) {
+ this.responses = [];
+ }
+
+ if (arguments.length == 1) {
+ body = method;
+ url = method = null;
+ }
+
+ if (arguments.length == 2) {
+ body = url;
+ url = method;
+ method = null;
+ }
+
+ push.call(this.responses, {
+ method: method,
+ url: url,
+ response: typeof body == "function" ? body : responseArray(body)
+ });
+ },
+
+ respond: function respond() {
+ if (arguments.length > 0) {
+ this.respondWith.apply(this, arguments);
+ }
+
+ var queue = this.queue || [];
+ var requests = queue.splice(0, queue.length);
+ var request;
+
+ while (request = requests.shift()) {
+ this.processRequest(request);
+ }
+ },
+
+ processRequest: function processRequest(request) {
+ try {
+ if (request.aborted) {
+ return;
+ }
+
+ var response = this.response || [404, {}, ""];
+
+ if (this.responses) {
+ for (var l = this.responses.length, i = l - 1; i >= 0; i--) {
+ if (match.call(this, this.responses[i], request)) {
+ response = this.responses[i].response;
+ break;
+ }
+ }
+ }
+
+ if (request.readyState != 4) {
+ this.log(response, request);
+
+ request.respond(response[0], response[1], response[2]);
+ }
+ } catch (e) {
+ sinon.logError("Fake server request processing", e);
+ }
+ },
+
+ restore: function restore() {
+ return this.xhr.restore && this.xhr.restore.apply(this.xhr, arguments);
+ }
+ };
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./core");
+ require("./fake_xdomain_request");
+ require("./fake_xml_http_request");
+ require("../format");
+ makeApi(sinon);
+ module.exports = sinon;
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else {
+ makeApi(sinon);
+ }
+}());
+
+/**
+ * @depend fake_server.js
+ * @depend fake_timers.js
+ */
+/**
+ * Add-on for sinon.fakeServer that automatically handles a fake timer along with
+ * the FakeXMLHttpRequest. The direct inspiration for this add-on is jQuery
+ * 1.3.x, which does not use xhr object's onreadystatehandler at all - instead,
+ * it polls the object for completion with setInterval. Dispite the direct
+ * motivation, there is nothing jQuery-specific in this file, so it can be used
+ * in any environment where the ajax implementation depends on setInterval or
+ * setTimeout.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function () {
+ function makeApi(sinon) {
+ function Server() {}
+ Server.prototype = sinon.fakeServer;
+
+ sinon.fakeServerWithClock = new Server();
+
+ sinon.fakeServerWithClock.addRequest = function addRequest(xhr) {
+ if (xhr.async) {
+ if (typeof setTimeout.clock == "object") {
+ this.clock = setTimeout.clock;
+ } else {
+ this.clock = sinon.useFakeTimers();
+ this.resetClock = true;
+ }
+
+ if (!this.longestTimeout) {
+ var clockSetTimeout = this.clock.setTimeout;
+ var clockSetInterval = this.clock.setInterval;
+ var server = this;
+
+ this.clock.setTimeout = function (fn, timeout) {
+ server.longestTimeout = Math.max(timeout, server.longestTimeout || 0);
+
+ return clockSetTimeout.apply(this, arguments);
+ };
+
+ this.clock.setInterval = function (fn, timeout) {
+ server.longestTimeout = Math.max(timeout, server.longestTimeout || 0);
+
+ return clockSetInterval.apply(this, arguments);
+ };
+ }
+ }
+
+ return sinon.fakeServer.addRequest.call(this, xhr);
+ };
+
+ sinon.fakeServerWithClock.respond = function respond() {
+ var returnVal = sinon.fakeServer.respond.apply(this, arguments);
+
+ if (this.clock) {
+ this.clock.tick(this.longestTimeout || 0);
+ this.longestTimeout = 0;
+
+ if (this.resetClock) {
+ this.clock.restore();
+ this.resetClock = false;
+ }
+ }
+
+ return returnVal;
+ };
+
+ sinon.fakeServerWithClock.restore = function restore() {
+ if (this.clock) {
+ this.clock.restore();
+ }
+
+ return sinon.fakeServer.restore.apply(this, arguments);
+ };
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require) {
+ var sinon = require("./core");
+ require("./fake_server");
+ require("./fake_timers");
+ makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require);
+ } else {
+ makeApi(sinon);
+ }
+}());
+
+/**
+ * @depend util/core.js
+ * @depend extend.js
+ * @depend collection.js
+ * @depend util/fake_timers.js
+ * @depend util/fake_server_with_clock.js
+ */
+/**
+ * Manages fake collections as well as fake utilities such as Sinon's
+ * timers and fake XHR implementation in one convenient object.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function () {
+ function makeApi(sinon) {
+ var push = [].push;
+
+ function exposeValue(sandbox, config, key, value) {
+ if (!value) {
+ return;
+ }
+
+ if (config.injectInto && !(key in config.injectInto)) {
+ config.injectInto[key] = value;
+ sandbox.injectedKeys.push(key);
+ } else {
+ push.call(sandbox.args, value);
+ }
+ }
+
+ function prepareSandboxFromConfig(config) {
+ var sandbox = sinon.create(sinon.sandbox);
+
+ if (config.useFakeServer) {
+ if (typeof config.useFakeServer == "object") {
+ sandbox.serverPrototype = config.useFakeServer;
+ }
+
+ sandbox.useFakeServer();
+ }
+
+ if (config.useFakeTimers) {
+ if (typeof config.useFakeTimers == "object") {
+ sandbox.useFakeTimers.apply(sandbox, config.useFakeTimers);
+ } else {
+ sandbox.useFakeTimers();
+ }
+ }
+
+ return sandbox;
+ }
+
+ sinon.sandbox = sinon.extend(sinon.create(sinon.collection), {
+ useFakeTimers: function useFakeTimers() {
+ this.clock = sinon.useFakeTimers.apply(sinon, arguments);
+
+ return this.add(this.clock);
+ },
+
+ serverPrototype: sinon.fakeServer,
+
+ useFakeServer: function useFakeServer() {
+ var proto = this.serverPrototype || sinon.fakeServer;
+
+ if (!proto || !proto.create) {
+ return null;
+ }
+
+ this.server = proto.create();
+ return this.add(this.server);
+ },
+
+ inject: function (obj) {
+ sinon.collection.inject.call(this, obj);
+
+ if (this.clock) {
+ obj.clock = this.clock;
+ }
+
+ if (this.server) {
+ obj.server = this.server;
+ obj.requests = this.server.requests;
+ }
+
+ obj.match = sinon.match;
+
+ return obj;
+ },
+
+ restore: function () {
+ sinon.collection.restore.apply(this, arguments);
+ this.restoreContext();
+ },
+
+ restoreContext: function () {
+ if (this.injectedKeys) {
+ for (var i = 0, j = this.injectedKeys.length; i < j; i++) {
+ delete this.injectInto[this.injectedKeys[i]];
+ }
+ this.injectedKeys = [];
+ }
+ },
+
+ create: function (config) {
+ if (!config) {
+ return sinon.create(sinon.sandbox);
+ }
+
+ var sandbox = prepareSandboxFromConfig(config);
+ sandbox.args = sandbox.args || [];
+ sandbox.injectedKeys = [];
+ sandbox.injectInto = config.injectInto;
+ var prop, value, exposed = sandbox.inject({});
+
+ if (config.properties) {
+ for (var i = 0, l = config.properties.length; i < l; i++) {
+ prop = config.properties[i];
+ value = exposed[prop] || prop == "sandbox" && sandbox;
+ exposeValue(sandbox, config, prop, value);
+ }
+ } else {
+ exposeValue(sandbox, config, "sandbox", value);
+ }
+
+ return sandbox;
+ },
+
+ match: sinon.match
+ });
+
+ sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer;
+
+ return sinon.sandbox;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./extend");
+ require("./util/fake_server_with_clock");
+ require("./util/fake_timers");
+ require("./collection");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}());
+
+/**
+ * @depend util/core.js
+ * @depend sandbox.js
+ */
+/**
+ * Test function, sandboxes fakes
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+ function makeApi(sinon) {
+ var slice = Array.prototype.slice;
+
+ function test(callback) {
+ var type = typeof callback;
+
+ if (type != "function") {
+ throw new TypeError("sinon.test needs to wrap a test function, got " + type);
+ }
+
+ function sinonSandboxedTest() {
+ var config = sinon.getConfig(sinon.config);
+ config.injectInto = config.injectIntoThis && this || config.injectInto;
+ var sandbox = sinon.sandbox.create(config);
+ var args = slice.call(arguments);
+ var oldDone = args.length && args[args.length - 1];
+ var exception, result;
+
+ if (typeof oldDone == "function") {
+ args[args.length - 1] = function sinonDone(result) {
+ if (result) {
+ sandbox.restore();
+ throw exception;
+ } else {
+ sandbox.verifyAndRestore();
+ }
+ oldDone(result);
+ };
+ }
+
+ try {
+ result = callback.apply(this, args.concat(sandbox.args));
+ } catch (e) {
+ exception = e;
+ }
+
+ if (typeof oldDone != "function") {
+ if (typeof exception !== "undefined") {
+ sandbox.restore();
+ throw exception;
+ } else {
+ sandbox.verifyAndRestore();
+ }
+ }
+
+ return result;
+ }
+
+ if (callback.length) {
+ return function sinonAsyncSandboxedTest(callback) {
+ return sinonSandboxedTest.apply(this, arguments);
+ };
+ }
+
+ return sinonSandboxedTest;
+ }
+
+ test.config = {
+ injectIntoThis: true,
+ injectInto: null,
+ properties: ["spy", "stub", "mock", "clock", "server", "requests"],
+ useFakeTimers: true,
+ useFakeServer: true
+ };
+
+ sinon.test = test;
+ return test;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./sandbox");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (sinon) {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend util/core.js
+ * @depend test.js
+ */
+/**
+ * Test case, sandboxes all test functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+ function createTest(property, setUp, tearDown) {
+ return function () {
+ if (setUp) {
+ setUp.apply(this, arguments);
+ }
+
+ var exception, result;
+
+ try {
+ result = property.apply(this, arguments);
+ } catch (e) {
+ exception = e;
+ }
+
+ if (tearDown) {
+ tearDown.apply(this, arguments);
+ }
+
+ if (exception) {
+ throw exception;
+ }
+
+ return result;
+ };
+ }
+
+ function makeApi(sinon) {
+ function testCase(tests, prefix) {
+ if (!tests || typeof tests != "object") {
+ throw new TypeError("sinon.testCase needs an object with test functions");
+ }
+
+ prefix = prefix || "test";
+ var rPrefix = new RegExp("^" + prefix);
+ var methods = {}, testName, property, method;
+ var setUp = tests.setUp;
+ var tearDown = tests.tearDown;
+
+ for (testName in tests) {
+ if (tests.hasOwnProperty(testName) && !/^(setUp|tearDown)$/.test(testName)) {
+ property = tests[testName];
+
+ if (typeof property == "function" && rPrefix.test(testName)) {
+ method = property;
+
+ if (setUp || tearDown) {
+ method = createTest(property, setUp, tearDown);
+ }
+
+ methods[testName] = sinon.test(method);
+ } else {
+ methods[testName] = tests[testName];
+ }
+ }
+ }
+
+ return methods;
+ }
+
+ sinon.testCase = testCase;
+ return testCase;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./test");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend times_in_words.js
+ * @depend util/core.js
+ * @depend match.js
+ * @depend format.js
+ */
+/**
+ * Assertions matching the test spy retrieval interface.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon, global) {
+ var slice = Array.prototype.slice;
+
+ function makeApi(sinon) {
+ var assert;
+
+ function verifyIsStub() {
+ var method;
+
+ for (var i = 0, l = arguments.length; i < l; ++i) {
+ method = arguments[i];
+
+ if (!method) {
+ assert.fail("fake is not a spy");
+ }
+
+ if (method.proxy && method.proxy.isSinonProxy) {
+ verifyIsStub(method.proxy);
+ } else {
+ if (typeof method != "function") {
+ assert.fail(method + " is not a function");
+ }
+
+ if (typeof method.getCall != "function") {
+ assert.fail(method + " is not stubbed");
+ }
+ }
+
+ }
+ }
+
+ function failAssertion(object, msg) {
+ object = object || global;
+ var failMethod = object.fail || assert.fail;
+ failMethod.call(object, msg);
+ }
+
+ function mirrorPropAsAssertion(name, method, message) {
+ if (arguments.length == 2) {
+ message = method;
+ method = name;
+ }
+
+ assert[name] = function (fake) {
+ verifyIsStub(fake);
+
+ var args = slice.call(arguments, 1);
+ var failed = false;
+
+ if (typeof method == "function") {
+ failed = !method(fake);
+ } else {
+ failed = typeof fake[method] == "function" ?
+ !fake[method].apply(fake, args) : !fake[method];
+ }
+
+ if (failed) {
+ failAssertion(this, (fake.printf || fake.proxy.printf).apply(fake, [message].concat(args)));
+ } else {
+ assert.pass(name);
+ }
+ };
+ }
+
+ function exposedName(prefix, prop) {
+ return !prefix || /^fail/.test(prop) ? prop :
+ prefix + prop.slice(0, 1).toUpperCase() + prop.slice(1);
+ }
+
+ assert = {
+ failException: "AssertError",
+
+ fail: function fail(message) {
+ var error = new Error(message);
+ error.name = this.failException || assert.failException;
+
+ throw error;
+ },
+
+ pass: function pass(assertion) {},
+
+ callOrder: function assertCallOrder() {
+ verifyIsStub.apply(null, arguments);
+ var expected = "", actual = "";
+
+ if (!sinon.calledInOrder(arguments)) {
+ try {
+ expected = [].join.call(arguments, ", ");
+ var calls = slice.call(arguments);
+ var i = calls.length;
+ while (i) {
+ if (!calls[--i].called) {
+ calls.splice(i, 1);
+ }
+ }
+ actual = sinon.orderByFirstCall(calls).join(", ");
+ } catch (e) {
+ // If this fails, we'll just fall back to the blank string
+ }
+
+ failAssertion(this, "expected " + expected + " to be " +
+ "called in order but were called as " + actual);
+ } else {
+ assert.pass("callOrder");
+ }
+ },
+
+ callCount: function assertCallCount(method, count) {
+ verifyIsStub(method);
+
+ if (method.callCount != count) {
+ var msg = "expected %n to be called " + sinon.timesInWords(count) +
+ " but was called %c%C";
+ failAssertion(this, method.printf(msg));
+ } else {
+ assert.pass("callCount");
+ }
+ },
+
+ expose: function expose(target, options) {
+ if (!target) {
+ throw new TypeError("target is null or undefined");
+ }
+
+ var o = options || {};
+ var prefix = typeof o.prefix == "undefined" && "assert" || o.prefix;
+ var includeFail = typeof o.includeFail == "undefined" || !!o.includeFail;
+
+ for (var method in this) {
+ if (method != "expose" && (includeFail || !/^(fail)/.test(method))) {
+ target[exposedName(prefix, method)] = this[method];
+ }
+ }
+
+ return target;
+ },
+
+ match: function match(actual, expectation) {
+ var matcher = sinon.match(expectation);
+ if (matcher.test(actual)) {
+ assert.pass("match");
+ } else {
+ var formatted = [
+ "expected value to match",
+ " expected = " + sinon.format(expectation),
+ " actual = " + sinon.format(actual)
+ ]
+ failAssertion(this, formatted.join("\n"));
+ }
+ }
+ };
+
+ mirrorPropAsAssertion("called", "expected %n to have been called at least once but was never called");
+ mirrorPropAsAssertion("notCalled", function (spy) {
+ return !spy.called;
+ }, "expected %n to not have been called but was called %c%C");
+ mirrorPropAsAssertion("calledOnce", "expected %n to be called once but was called %c%C");
+ mirrorPropAsAssertion("calledTwice", "expected %n to be called twice but was called %c%C");
+ mirrorPropAsAssertion("calledThrice", "expected %n to be called thrice but was called %c%C");
+ mirrorPropAsAssertion("calledOn", "expected %n to be called with %1 as this but was called with %t");
+ mirrorPropAsAssertion("alwaysCalledOn", "expected %n to always be called with %1 as this but was called with %t");
+ mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new");
+ mirrorPropAsAssertion("alwaysCalledWithNew", "expected %n to always be called with new");
+ mirrorPropAsAssertion("calledWith", "expected %n to be called with arguments %*%C");
+ mirrorPropAsAssertion("calledWithMatch", "expected %n to be called with match %*%C");
+ mirrorPropAsAssertion("alwaysCalledWith", "expected %n to always be called with arguments %*%C");
+ mirrorPropAsAssertion("alwaysCalledWithMatch", "expected %n to always be called with match %*%C");
+ mirrorPropAsAssertion("calledWithExactly", "expected %n to be called with exact arguments %*%C");
+ mirrorPropAsAssertion("alwaysCalledWithExactly", "expected %n to always be called with exact arguments %*%C");
+ mirrorPropAsAssertion("neverCalledWith", "expected %n to never be called with arguments %*%C");
+ mirrorPropAsAssertion("neverCalledWithMatch", "expected %n to never be called with match %*%C");
+ mirrorPropAsAssertion("threw", "%n did not throw exception%C");
+ mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C");
+
+ sinon.assert = assert;
+ return assert;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./match");
+ require("./format");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+
+}(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global));
+
+ return sinon;
+}));
+++ /dev/null
-/**
- * Sinon.JS 1.15.0, 2015/05/30
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
- *
- * (The BSD License)
- *
- * Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of Christian Johansen nor the names of his contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * Helps IE run the fake timers. By defining global functions, IE allows
- * them to be overwritten at a later point. If these are not defined like
- * this, overwriting them will result in anything from an exception to browser
- * crash.
- *
- * If you don't require fake timers to work in IE, don't include this file.
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-if (typeof window !== "undefined") {
- function setTimeout() {}
- function clearTimeout() {}
- function setImmediate() {}
- function clearImmediate() {}
- function setInterval() {}
- function clearInterval() {}
- function Date() {}
-
- // Reassign the original functions. Now their writable attribute
- // should be true. Hackish, I know, but it works.
- setTimeout = sinon.timers.setTimeout;
- clearTimeout = sinon.timers.clearTimeout;
- setImmediate = sinon.timers.setImmediate;
- clearImmediate = sinon.timers.clearImmediate;
- setInterval = sinon.timers.setInterval;
- clearInterval = sinon.timers.clearInterval;
- Date = sinon.timers.Date;
-}
-
-/**
- * Helps IE run the fake XMLHttpRequest. By defining global functions, IE allows
- * them to be overwritten at a later point. If these are not defined like
- * this, overwriting them will result in anything from an exception to browser
- * crash.
- *
- * If you don't require fake XHR to work in IE, don't include this file.
- *
- * @author Christian Johansen (christian@cjohansen.no)
- * @license BSD
- *
- * Copyright (c) 2010-2013 Christian Johansen
- */
-if (typeof window !== "undefined") {
- function XMLHttpRequest() {}
-
- // Reassign the original function. Now its writable attribute
- // should be true. Hackish, I know, but it works.
- XMLHttpRequest = sinon.xhr.XMLHttpRequest || undefined;
-}
-/**
- * Helps IE run the fake XDomainRequest. By defining global functions, IE allows
- * them to be overwritten at a later point. If these are not defined like
- * this, overwriting them will result in anything from an exception to browser
- * crash.
- *
- * If you don't require fake XDR to work in IE, don't include this file.
- */
-if (typeof window !== "undefined") {
- function XDomainRequest() {}
-
- // Reassign the original function. Now its writable attribute
- // should be true. Hackish, I know, but it works.
- XDomainRequest = sinon.xdr.XDomainRequest || undefined;
-}
--- /dev/null
+/**
+ * Sinon.JS 1.15.4, 2015/06/27
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
+ *
+ * (The BSD License)
+ *
+ * Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of Christian Johansen nor the names of his contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Helps IE run the fake timers. By defining global functions, IE allows
+ * them to be overwritten at a later point. If these are not defined like
+ * this, overwriting them will result in anything from an exception to browser
+ * crash.
+ *
+ * If you don't require fake timers to work in IE, don't include this file.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+if (typeof window !== "undefined") {
+ function setTimeout() {}
+ function clearTimeout() {}
+ function setImmediate() {}
+ function clearImmediate() {}
+ function setInterval() {}
+ function clearInterval() {}
+ function Date() {}
+
+ // Reassign the original functions. Now their writable attribute
+ // should be true. Hackish, I know, but it works.
+ setTimeout = sinon.timers.setTimeout;
+ clearTimeout = sinon.timers.clearTimeout;
+ setImmediate = sinon.timers.setImmediate;
+ clearImmediate = sinon.timers.clearImmediate;
+ setInterval = sinon.timers.setInterval;
+ clearInterval = sinon.timers.clearInterval;
+ Date = sinon.timers.Date;
+}
+
+/**
+ * Helps IE run the fake XMLHttpRequest. By defining global functions, IE allows
+ * them to be overwritten at a later point. If these are not defined like
+ * this, overwriting them will result in anything from an exception to browser
+ * crash.
+ *
+ * If you don't require fake XHR to work in IE, don't include this file.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+if (typeof window !== "undefined") {
+ function XMLHttpRequest() {}
+
+ // Reassign the original function. Now its writable attribute
+ // should be true. Hackish, I know, but it works.
+ XMLHttpRequest = sinon.xhr.XMLHttpRequest || undefined;
+}
+/**
+ * Helps IE run the fake XDomainRequest. By defining global functions, IE allows
+ * them to be overwritten at a later point. If these are not defined like
+ * this, overwriting them will result in anything from an exception to browser
+ * crash.
+ *
+ * If you don't require fake XDR to work in IE, don't include this file.
+ */
+if (typeof window !== "undefined") {
+ function XDomainRequest() {}
+
+ // Reassign the original function. Now its writable attribute
+ // should be true. Hackish, I know, but it works.
+ XDomainRequest = sinon.xdr.XDomainRequest || undefined;
+}
// Button styling
// ----------------------------------------------------------------------------
-.button-colors(@bgColor, @highlightColor) {
+.button-colors(@bgColor, @highlightColor, @activeColor) {
background: @bgColor;
&:hover {
&:active,
&.mw-ui-checked {
- background: @highlightColor;
+ background: @activeColor;
box-shadow: none;
}
}
-.button-colors(@bgColor, @highlightColor) when (lightness(@bgColor) >= 70%) {
+.button-colors(@bgColor, @highlightColor, @activeColor) when (lightness(@bgColor) >= 70%) {
color: @colorButtonText;
border: 1px solid @colorGray12;
}
}
-.button-colors(@bgColor, @highlightColor) when (lightness(@bgColor) < 70%) {
+.button-colors(@bgColor, @highlightColor, @activeColor) when (lightness(@bgColor) < 70%) {
color: #fff;
// border of the same color as background so that light background and
// dark background buttons are the same height and width
}
}
-.button-colors-quiet(@textColor, @highlightColor) {
+.button-colors-quiet(@textColor, @highlightColor, @activeColor) {
// Quiet buttons all start gray, and reveal
// constructive/progressive/destructive color on hover and active.
color: @colorButtonText;
&:active,
&.mw-ui-checked {
- color: @highlightColor;
+ color: @activeColor;
}
&:disabled {
// Blue; for contextual use of a continuing action
@colorProgressive: #347bff;
@colorProgressiveHighlight: #2962CC;
+@colorProgressiveActive: #2962CC;
// Green; for contextual use of a positive finalizing action
@colorConstructive: #00af89;
@colorConstructiveHighlight: #008C6D;
+@colorConstructiveActive: #008C6D;
// Orange; for contextual use of returning to a past action
@colorRegressive: #FF5D00;
// Red; for contextual use of a negative action of high severity
@colorDestructive: #d11d13;
@colorDestructiveHighlight: #A7170F;
+@colorDestructiveActive: #A7170F;
// Orange; for contextual use of a potentially negative action of medium severity
@colorMediumSevere: #FF5D00;
// Yellow; for contextual use of a potentially negative action of low severity
@colorTextLight: @colorGray6;
@colorButtonText: @colorGray5;
@colorButtonTextHighlight: @colorGray7;
+@colorButtonTextActive: @colorGray7;
@colorDisabledText: @colorGray12;
@colorErrorText: #CC0000;
zoom: 1;
// Container styling
- .button-colors(#FFF, #CCC);
+ .button-colors(#FFF, #CCC, #777);
border-radius: @borderRadius;
min-width: 4em;
// Styleguide 2.1.1.
&.mw-ui-progressive,
&.mw-ui-primary {
- .button-colors(@colorProgressive, @colorProgressiveHighlight);
+ .button-colors(@colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive);
&.mw-ui-quiet {
- .button-colors-quiet(@colorProgressive, @colorProgressiveHighlight);
+ .button-colors-quiet(@colorProgressive, @colorProgressiveHighlight, @colorProgressiveActive);
}
}
//
// Styleguide 2.1.2.
&.mw-ui-constructive {
- .button-colors(@colorConstructive, @colorConstructiveHighlight);
+ .button-colors(@colorConstructive, @colorConstructiveHighlight, @colorConstructiveActive);
&.mw-ui-quiet {
- .button-colors-quiet(@colorConstructive, @colorConstructiveHighlight);
+ .button-colors-quiet(@colorConstructive, @colorConstructiveHighlight, @colorConstructiveActive);
}
}
//
// Styleguide 2.1.3.
&.mw-ui-destructive {
- .button-colors(@colorDestructive, @colorDestructiveHighlight);
+ .button-colors(@colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive);
&.mw-ui-quiet {
- .button-colors-quiet(@colorDestructive, @colorDestructiveHighlight);
+ .button-colors-quiet(@colorDestructive, @colorDestructiveHighlight, @colorDestructiveActive);
}
}
background: transparent;
border: none;
text-shadow: none;
- .button-colors-quiet(@colorButtonText, @colorButtonTextHighlight);
+ .button-colors-quiet(@colorButtonText, @colorButtonTextHighlight, @colorButtonTextActive);
&:hover,
&:focus {
* @param {Object} [config] Configuration options
* @cfg {number} [limit=10] Number of results to show
* @cfg {number} [namespace] Namespace to prepend to queries
+ * @cfg {boolean} [relative=true] If a namespace is set, return a title relative to it
* @cfg {boolean} [showRedirectTargets=true] Show the targets of redirects
* @cfg {boolean} [showRedlink] Show red link to exact match if it doesn't exist
* @cfg {boolean} [showImages] Show page images
// Properties
this.limit = config.limit || 10;
this.namespace = config.namespace || null;
+ this.relative = config.relative !== undefined ? config.relative : true;
this.showRedirectTargets = config.showRedirectTargets !== false;
this.showRedlink = !!config.showRedlink;
this.showImages = !!config.showImages;
mw.widgets.TitleInputWidget.prototype.getOptionWidgetData = function ( title, data ) {
var mwTitle = new mw.Title( title );
return {
- data: this.namespace !== null ? mwTitle.getRelativeText( this.namespace ) : title,
+ data: this.namespace !== null && this.relative
+ ? mwTitle.getRelativeText( this.namespace )
+ : title,
imageUrl: this.showImages ? data.imageUrl : null,
description: this.showDescriptions ? data.description : null,
missing: data.missing,
*/
( function ( mw, $ ) {
$( function () {
- var api, map, resultRenderCache, searchboxesSelectors,
+ var api, map, searchboxesSelectors,
// Region where the suggestions box will appear directly below
// (using the same width). Can be a container element or the input
// itself, depending on what suits best in the environment.
}
// Compute form data for search suggestions functionality.
- function computeResultRenderCache( context ) {
+ function getFormData( context ) {
var $form, baseHref, linkParams;
- // Compute common parameters for links' hrefs
- $form = context.config.$region.closest( 'form' );
+ if ( !context.formData ) {
+ // Compute common parameters for links' hrefs
+ $form = context.config.$region.closest( 'form' );
- baseHref = $form.attr( 'action' );
- baseHref += baseHref.indexOf( '?' ) > -1 ? '&' : '?';
+ baseHref = $form.attr( 'action' );
+ baseHref += baseHref.indexOf( '?' ) > -1 ? '&' : '?';
- linkParams = $form.serializeObject();
+ linkParams = $form.serializeObject();
- return {
- textParam: context.data.$textbox.attr( 'name' ),
- linkParams: linkParams,
- baseHref: baseHref
- };
+ context.formData = {
+ textParam: context.data.$textbox.attr( 'name' ),
+ linkParams: linkParams,
+ baseHref: baseHref
+ };
+ }
+
+ return context.formData;
}
/**
// The function used to render the suggestions.
function renderFunction( text, context ) {
- if ( !resultRenderCache ) {
- resultRenderCache = computeResultRenderCache( context );
- }
+ var formData = getFormData( context );
// linkParams object is modified and reused
- resultRenderCache.linkParams[ resultRenderCache.textParam ] = text;
+ formData.linkParams[ formData.textParam ] = text;
// this is the container <div>, jQueryfied
this.text( text )
.wrap(
$( '<a>' )
- .attr( 'href', resultRenderCache.baseHref + $.param( resultRenderCache.linkParams ) )
+ .attr( 'href', formData.baseHref + $.param( formData.linkParams ) )
.attr( 'title', text )
.addClass( 'mw-searchSuggest-link' )
);
}
function specialRenderFunction( query, context ) {
- var $el = this;
-
- if ( !resultRenderCache ) {
- resultRenderCache = computeResultRenderCache( context );
- }
+ var $el = this,
+ formData = getFormData( context );
// linkParams object is modified and reused
- resultRenderCache.linkParams[ resultRenderCache.textParam ] = query;
+ formData.linkParams[ formData.textParam ] = query;
if ( $el.children().length === 0 ) {
$el
}
if ( $el.parent().hasClass( 'mw-searchSuggest-link' ) ) {
- $el.parent().attr( 'href', resultRenderCache.baseHref + $.param( resultRenderCache.linkParams ) + '&fulltext=1' );
+ $el.parent().attr( 'href', formData.baseHref + $.param( formData.linkParams ) + '&fulltext=1' );
} else {
$el.wrap(
$( '<a>' )
- .attr( 'href', resultRenderCache.baseHref + $.param( resultRenderCache.linkParams ) + '&fulltext=1' )
+ .attr( 'href', formData.baseHref + $.param( formData.linkParams ) + '&fulltext=1' )
.addClass( 'mw-searchSuggest-link' )
);
}
}
/**
+ * Broken per T70653.
+ *
* @group large
+ * @group Broken
*/
function testCheckpointPlain() {
$this->checkpointHelper();
'test.sinonjs' => array(
'scripts' => array(
- 'resources/lib/sinonjs/sinon-1.15.0.js',
+ 'resources/lib/sinonjs/sinon-1.15.4.js',
// We want tests to work in IE, but can't include this as it
// will break the placeholders in Sinon because the hack it uses
// to hijack IE globals relies on running in the global scope
// and in ResourceLoader this won't be running in the global scope.
// Including it results (among other things) in sandboxed timers
// being broken due to Date inheritance being undefined.
- // 'resources/lib/sinonjs/sinon-ie-1.15.0.js',
+ // 'resources/lib/sinonjs/sinon-ie-1.15.4.js',
),
'targets' => array( 'desktop', 'mobile' ),
),
}
},
teardown: function () {
- this.sandbox.verifyAndRestore();
-
if ( localEnv.teardown ) {
localEnv.teardown.call( this );
}
+
+ this.sandbox.verifyAndRestore();
}
} );
};